-
Memory issue...
Hello. I am working on a browser. After parsing the web-page, I will be creating a class Graphic node and attaching it to the first and so on. After the user hops to another page, I will be freeing the memory of the class Graphic linked list objects, and renew the process. My question is, is this a bad idea? Would an array of Graphic objects be better since each element is reused, or will Windows be properly reclaiming the memory deallocated from the linked list version?
-
I don't think anyone here really knows whether or not windows reallocations and redistributes memory well or not. I think we all assume that it does. And that assumption has taken many of us far ;) You should do it dynamically since static allocation has limitations to the static heap. If you make an large heap to overcome limitations you create a large memory hog that didn't need to be there in the first place. You want to avoid memory waste more than anything else.
-
As long as you free any memory you've allocated, and any GDI objects you've created, Windows will free up the memory. Do not, however, expect to see the memory usage figure change smoothly, i.e. allocating a 100 bytes may or may not increase your tasks memory allocation, similaly, freeing some memory may not change the allocation.
The memory manager allocates and deallocates memory in largeish chunks, and does so as required by the system rather than the vagaries of the program.
-