Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
System.Diagnostics.Process.PrivateMemorySize64 rolls over as if it is returning a 32 bit int instead of 64 bit int
Occurs when a mono 2.10.x process grows to be larger then 2 gigs of used memory. Used to work in Mono 2.6.4; problem was introduced since then.
Steps to reproduce:
1) Create a mono process that uses more then 2.2 gigs of memory
2) Call any System.Diagnostics.Process memory related methods
Observed Behavior: they return negative values when above 2 gigs
Expected Behavior: reporting values that match /proc/<pid>/status
When we upgraded from Mono 2.6.4 to 2.10.3 we noticed that the System.Diagnostics.Process memory related methods were returning negative values. Our app uses up to 20 gigs of memory sometimes. Tracked this down to a change in mono/utils/mono-proclib.c to move a 1024 multiplier for these values inside of a subroutine. But then the compiler does the multiplication within a 32 bit result of an "atoi" call (that converts the linux /proc/<pid>/status results from string to int). Our patch below resolved the issue, and involves making sure the compiler knows we want the multiplication to occur in a 64 bit value plus we switched from atoi to atol to future proof.
Patch to resolve the problem:
--- mono/utils/mono-proclib.c 2011-07-27 15:13:39.000000000 -0700
+++ /home/UNIXHOME/agottschalk/mono-proclib.c 2011-10-10 12:47:55.000004000 -0700
@@ -431,7 +431,7 @@
s = get_pid_status_item_buf (pid, item, buf, sizeof (buf), error);
- return atoi (s) * multiplier;
+ return ((gint64) atol (s)) * multiplier;
Applied to HEAD/mono-2-10 branch. Thanks for the patch.