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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Releasing Memory from a menu

Status
Not open for further replies.

darkman0101

Technical User
Oct 10, 2000
51
NZ
I have an application that uses a system Tray control that I have written (very similar to the one that MS give as an example) to put an icon in the system tray.

On the form that this control is attached to is a menu structure (created with the menu editor tool). When the systray icon is clicked this menu is displayed using
popupmenu mnuMenu,0,,,mnuItem
when this menu is loaded and displayed the memory usage jumps from 2584K to 2620 when the menu is shown to 2840K when an item is highlighted.

This memory is not released when one of the menu item is selected (even one that has nothing associated with it's click event).
How can I unload this menu?

Also
if you declare a variable as variant do you have to set it to nothing to release it's memory

Cheers in advance
Jas
 
How can I unload this menu?{/i]

I think Windows caches menus until the application that created them ends. So you'd have to unload your system tray app, then reload it (ugly). I'd live with it, unless the memory keeps increasing every time you pop the menu up. (which would imply a memory leak).

if you declare a variable as variant do you have to set it to nothing to release it's memory

Only if it's holding a reference to an object, in which case you ought to be using an object variable, not a variant. But normally, there's no need to set a variant to nothing, as it's memory will be released when it goes out of scope.

Chip H.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top