gsauthof / cgmemtime

cgmemtime measures the high-water RSS+CACHE memory usage of a process and its descendant processes.
106 stars 16 forks source link

Bug with big memory usage #3

Closed beatmax closed 8 years ago

beatmax commented 8 years ago

You get crazy numbers when the memory usage doesn't fit in an int. The fix is easy:

-  output->cg_rss_highwater = atoi(out);
+  if (sscanf(out, "%zu", &output->cg_rss_highwater) != 1)
+    return -1;

That's the right way to parse a number into a size_t.

gsauthof commented 8 years ago

Thanks for the report.