Anyone know code to get the currently used memory. I want to get the total memory used in a function, so I thought I would get the memory before the function executes, and then subtract this from the memory after the function is complete.
Thanks!
Printable View
Anyone know code to get the currently used memory. I want to get the total memory used in a function, so I thought I would get the memory before the function executes, and then subtract this from the memory after the function is complete.
Thanks!
As the GC wont release the resources immediately after you are done with them, the memory usage after your function is complete may not be accurate.
I guess the best way would be through the task manager - and see what the peak memory usage is during execution of the function.
These properties of the Process class will help you but the results wont be what you need because of the GC.
PagedMemorySize
PagedSystemMemorySize
PeakPagedMemorySize
PeakVirtualMemorySize
PeakWorkingSet