Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualBacterius

Posted 03 July 2012 - 05:39 AM

Instead, from the Task Manager (I've also another application called Process Explorer that shows memory usage more in detail) the memory is not freed.

How much memory are you actually allocating? Memory is allocated in rather large pages, so freeing juste a few kB of memory may not actually cause any page to get deallocated.

    It is my understanding that vectors will only free memory allocated to storing the structs themselves. If the structs contain any reference to other data (such as pointers to objects), the data will still be there - only the memory allocated to storing the reference will have been freed. So if you have anything other than primitive types (like ints, etc...) in your struct, you need to explicitly free the objects they point to since they are actually references.

#1Bacterius

Posted 03 July 2012 - 05:34 AM

Instead, from the Task Manager (I've also another application called Process Explorer that shows memory usage more in detail) the memory is not freed.

How much memory are you actually allocating? Memory is allocated in rather large pages, so freeing juste a few kB of memory may not actually cause any page to get deallocated.

It is my understanding that vectors will only free memory allocated to storing the structs themselves. If the structs contain any reference to other data (such as pointers to objects), the data will still be there - only the memory allocated to storing the reference will have been freed. So if you have anything other than primitive types (like ints, etc...) in your struct, you need to free them explicitly since they are actually references.

PARTNERS