Hi,
I have this problem: I load a lot of data into memory, then I delete it and reload other data, and so on.
Example (actually it is more complex):
---
open file FILE1
elaborate FILE1 data
show results to the user
close file FILE1 and delete elaborated data
open file FILE2
elaborate FILE2 data
show results to the user
close file FILE2 and delete elaborated data
---
If FILE1 data requires 10 MB of RAM and FILE2 30 MB of RAM, I get this sequence:
open FILE1 -> RAM = 10 MB
close FILE1 -> RAM = 10 MB (not released?)
open FILE2 -> RAM = 30 MB
close FILE2 -> RAM = 30 MB (not released?)
If (opposite) FILE1 data requires 30 MB of RAM and FILE2 10 MB of RAM, I get this sequence:
open FILE1 -> RAM = 30 MB
close FILE1 -> RAM = 30 MB (not released?)
open FILE2 -> RAM = 30 MB
close FILE2 -> RAM = 30 MB (not released?)
I am deleting everything, at least I think so, I also made some tests.
Moreover if this is not the case in both the conditions I would end up with 40 MB of RAM occupied, but this never happens.
My understanding is that Qt knows what has been freed and reuses that memory when needed, but it does not release the memory to the OS once it has been allocated.
I saw this behaviour with both Linux and Windows; both Qt3 and Qt4.
Can someone explain me why this behaviour? Is there a way to avoid it?
Thanks for any help!
Bookmarks