Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Free Used Memory

Status
Not open for further replies.

ronnyjljr

IS-IT--Management
Nov 23, 2003
249
US
Hiya,

I have an application that displays a picture, of any size and types jpg, bmp, gif. Typical OLE readable formats. Anyways I can view them just fine but then when I close the dialog the memory is not freed. How would I go about doing this? I have try to delete the actual picture reference and the dialog reference after closing but the ram still shows that the 1 or 2MBS is still in use. Any help?

-Ron

/**************
Me: When will the project be finished?
Them: What project?
Me: The one you have been working on for the last 3 years!
Them: Ohh, we can't finish it?
Me: Why?
Them: We don't know how to program...
 
What are you using to see how much memory is still allocated? It may be that you did "free" the memory, but the way Windows applications work, the virtual address space of your application might not shrink back to the size it was before, at least not right away.

How are you loading the pictures you are displaying? Something like a CBitmap selected into a CDC? Make sure you un-select the bitmap from the DC before the dialog box is destroyed. Just call SelectObject() again and re-select the value that was returned when you called SelectObject() the first time.

Are you using an ActiveX control to display the pictures? Make sure you release any interface pointers to the control when the dialog is destroyed.
 
My understand of the way windows works is that the memory is "free'd" for use, but only by the same application. You have to exit the application before it is free for other applications to use.

So unfortunately I dont think there is a way??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top