From what I've understood, dynamic memory allocation can be used to control lifetime of an object. When I "new" an object, it stays in memory, on the heap, until I delete it.
Now, sometimes things aren't that simple. This is the case in a scenario, in which I'd like to keep certain block of memory reserved, until I free it, preventing destruction of the data in that memory block. For example, I'd like to insert a pointer to an object allocated on the stack into a vector. Whenever a pointer to an object is in that vector, the object the pointer points to cannot be destroyed. This is for safety reasons. How can one accomplish this, reserve a block of memory using dynamic memory allocation?