If you didn't create an object using
new
, then it's not your problem and there's nothing you can do about it anyway. The memory will be reclaimed when the object goes out of scope.
You are not creating pointers using
new, so you cannot free the memory they are taking. It will be done when the pointers go out of scope.
You do not appear to be creating the objects the pointers are pointing at using
new, so you cannot free the memory those objects are taking. It will be done when the objects go out of scope.
my app is using alot of pointers, which is the best way to free up the memory when they are no longer needed? |
A pointer often takes up the same amount of memory as an
int; on the system I'm typing this on, four bytes. If you are so short of memory that four bytes is an issue, I think you need to rethink your design.
I think you have misunderstood the relationship between
new,
delete and pointers; possibly, you've misunderstood what a pointer is as well.