PDA

View Full Version : heap memory size



aya_lawliet
5th September 2011, 15:23
is there a way to find out the heap memory size?

I'm creating an application that dynamically creates objects, and i need to find out if the created objects are destroyed when a certain condition is met. And one way to find out if the objects are destroyed is by finding out the heap memory size, before the object is created and the size after it was destroyed.

Is there any way to do this?

Thank you very much.

stampede
5th September 2011, 15:51
And one way to find out if the objects are destroyed is by finding out the heap memory size, before the object is created and the size after it was destroyed
Thats unreliable method, you can have less memory available after releasing the objects, because some background app could use it.
If those objects are QObject-based you can connect to "destroyed()" signal. If not, use some kind of reference-counting to track down the number of existing objects.

aya_lawliet
5th September 2011, 15:56
Thank you very much for your input. I will try that.