You can try achieve this by implementing your own memory manager and overloading new operator.