Hi All, I'm getting very confused with memory management in relation to vectors and could do with some basic concepts explaining.
I have a program that uses big vectors. I created the vectors with the new operator and release them at the end of the program with delete to get the memory back.
My question is, if the program crashes or gets aborted for what ever reason, the delete lines will be missed, is there a way to recover the memory even in this scenario.
I also have some other large vectors that I assign without the new keyword. I have read that these will be created on the heap but do not need to be deallocated in anyway as the memory management is dealt with 'under the hood'. However I am not sure this is the case as every time I run my program I lose RAM.
So my second question is, can vectors created without the new keyword really be left to their own devices and trusted to clear up after themselves even if code is aborted mid flow.
And I suppose a third question that has just sprung to mind is, if Vectors are automatically created on the heap why would you ever use the new keyword with them? Thanks for reading, ben