Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » How does widget/variable destruction in U++ work?
Re: How does widget/variable destruction in U++ work? [message #38358 is a reply to message #38357] Wed, 12 December 2012 11:37 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

crydev wrote on Wed, 12 December 2012 10:53

The 600 KB memory that has been eaten is not being freed. Logically using C++ this way, the SettingsDialog variable that I created inside the function is destroyed as soon as the function finishes, and the used memory is freed.

Now I know that task manager is not the greatest tool to monitor memory usage as it is not quite as accurate as it should be. But this situation certainly brought up the question to me as it were: How does variable destruction and memory releasing work in U++?

Hi crydev,

U++ uses its own allocator, which works little bit different Smile It allocates memory in chunks and then gives it to the variables that requested it (when new is called). When the memory is returned (delete is called) it keeps the allocated memory to allow future allocation to work faster. I'm not sure if it is describe in detail somewhere, but try searching the site and forum. Try repeating the action that allocated the memory again, the memory usage should not increase second time.

Also, IIRC the OS itself usually allocates and deallocates memory for application in larger chunks, to lower the associated overhead.

To see detailed info about memory, you can use MemoryUsedKb() and some other U++ memory related functions.

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is there a Zip/UnZip example?
Next Topic: GuiLock when creating widgets
Goto Forum:
  


Current Time: Tue May 07 05:46:34 CEST 2024

Total time taken to generate the page: 0.02913 seconds