winforms - C# Application, Monitor Memory Consumption -
is there way can monitor memory consumption within c# application? dynamically change variable based upon amount of memory program using.
i have code completing queries data base , temporarily holding data before write file. have code allows user manually change @ point data dumped memory , written file, want program handle automatically.
for example; if process reaches 700,000k memory usage (like viewed task manager, decrement integer , continue processing.
thanks, eric
you can current memory usage way:
var proc = system.diagnostics.process.getcurrentprocess(); var mbused = (proc.privatememorysize64/1024)/1024; privatememorysize64 long representing amount of memory used in bytes.
Comments
Post a Comment