S
Stephen Barrett
I am looking for a way to fine a definitive answer of how many instances of
a particular class are in memory. I am hoping there is a framework class
that can help me with this.
I have tried to code thsi logic into the class by creating a static variable
to hold the count and then increment it in the constructor and decrement it
in the destructor (also tried to decrement in dispose at one point). I
provided a threadsafe locking mechanism on the increment and decrement
methods.
The problem is that it doesn't seem that my destructor is actually getting
called so the decrement never happens. This class is instantiated via
remoting configured as a SingleCall action. My understanding is that the
object should be created on a call to the remoted method and as soon as the
method exits, the destructor should get called.
I want to verify that I am not doing something wrong by using a framework
method or something to get teh instances in memory of the class. I knwo
some memory profilers have this ability, but I need it to be a runtime value
I can get and log.
Any help would be appreciated.
a particular class are in memory. I am hoping there is a framework class
that can help me with this.
I have tried to code thsi logic into the class by creating a static variable
to hold the count and then increment it in the constructor and decrement it
in the destructor (also tried to decrement in dispose at one point). I
provided a threadsafe locking mechanism on the increment and decrement
methods.
The problem is that it doesn't seem that my destructor is actually getting
called so the decrement never happens. This class is instantiated via
remoting configured as a SingleCall action. My understanding is that the
object should be created on a call to the remoted method and as soon as the
method exits, the destructor should get called.
I want to verify that I am not doing something wrong by using a framework
method or something to get teh instances in memory of the class. I knwo
some memory profilers have this ability, but I need it to be a runtime value
I can get and log.
Any help would be appreciated.