Is it possible to make listener like the PerformanceCounter
on the cpu or memory but need it for a variable during execution to know each time what is the size of the variable (example dictionary).
Asked
Active
Viewed 95 times
0
-
*Size* like number of items in the dictionary or *size* like number of bytes in memory? – oleksii Apr 08 '15 at 11:17
-
I think there is no direct way to retrieve the actual size of the object, but you can use for example MemoryStream. Serialize the object and push it to mem stream. (But, i am not sure if this is good idea). – Baranovskiy Dmitry Apr 08 '15 at 11:42
-
@oleksii bytes in memory will be better – Omega Apr 08 '15 at 13:22
-
@BaranovskiyDmitry the variable which i want to make listener is already on DLL so i can just get the name of this variable i think – Omega Apr 08 '15 at 13:23
-
1@Omega There is nothing out of the box available for that. You can probably start from [here](http://stackoverflow.com/a/3173599/706456) – oleksii Apr 08 '15 at 14:07