Is there any way I can find how many objects are instanciated from stack and how many objects from Heap. I dont wish to have the restrictions of scoping in objects from Stack
<p>Is there any way I can find how many objects are instanciated from stack and how many objects from Heap. I dont wish to have the restrictions of scoping in objects from Stack.</p>

<p>If i use a static counter in constructor and destructor, it will be called in both the cases(object from stack and heap). One way is to exploit the idea are objects from stack are scoped and destructor is called when they go out of scope but i want a better solution so as to know the number of objects at any point of time.</p>
