Subscribe

More local heap references

Collecting yet more references for implementing a custom heap for C++. One of the issues you run into when using a custom heap is the notion of placement new: void *operator new (size_t size, Heap &heap) { return heap.Allocate(size); }

Object allocations now appear so:

Heap local; obj *p = new (local) obj();

And when deleting the memory you must ensure that you give it back to the heap:

operator delete(p, local);

That last part makes the system less friendly. You can however override the operator new and delete for ‘obj’ and give it knoledge of a local heap.

More references:

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Technorati
  • Reddit
  • Digg
  • del.icio.us
  • StumbleUpon
  • DZone
  • ThisNext

Related posts:

Trackback URI | Comments RSS

Leave a Reply