Destroying a Window

Just starting out? Need help? Post your questions and find answers here.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Destroying a Window

Post by Xombie »

I've got a main window and a couple of child windows that I create on the fly (as an example - an About window). When the child window is first created, the memory used by the program jumps up to reflect the new window, gadgets, etc... However, when the user clicks the 'Close Button', I call CloseWindow() with the child window but the memory used does not go back down.

Isn't that supposed to be how it works? Shouldn't CloseWindow() free up the window and any child controls and free the memory used by those controls?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

How are you measuring memory?
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Mem Usage in the Windows Task Manager program. Before I open the second window, after it's opened and after I close it.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I think this is because Windows doesn't want to keep re-allocating memory all the time, as this takes time. So the memory usage of your program will only go down again when there is little memory on your computer.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Thanks for the reply.

Is there any way to clean this up? I hate for it to seem like my program is leaking memory. I'm putting in all kinds of memory cleanup stuff in there and hate to see it go to waste when Windows itself is too lazy to actually free the stuff up after I tell it to.
Post Reply