How does delete [] work?

If you want to allocate dynamical an array of objects you can use this:
Base *p = new Derived[n]
So you're telling the size (n) and the type of the object (Derived).

But when you want to free that memory just need delete [] p;
So how does delete[] know how big was my array? where's that info stored?
Somewhere

over the rainbow
in a place up high

(i dont know either but im guessing its stored in some table, or maybe the OS takes care of it)
Last edited on
Short answer: Magic.
Topic archived. No new replies allowed.