diff options
author | monojenkins <jo.shields+jenkins@xamarin.com> | 2020-02-24 14:08:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 14:08:03 +0300 |
commit | e7b4669bc9a21b079a8fa1e8aae454ff6396d395 (patch) | |
tree | c5c83eabd019fb3ea7c284ba8629e2e415b69c79 | |
parent | fc145be98c719a15ed7182506185e84851803e1d (diff) |
Added some parenthesis and a cast to control order of operations. (#18984)mono-6.10.0.82
This fixes https://github.com/mono/mono/issues/17140; intermittent incorrect results from GetTotalBytesAllocated for current thread. uint64_t and a pointer difference are not the same type/width on all architectures, so incorrect results can happen with out the parenthesis.
Co-authored-by: Nathan Ricci <naricc@microsoft.com>
-rw-r--r-- | mono/metadata/sgen-mono.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index f6f90c965c0..aebbda00677 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -2634,7 +2634,7 @@ mono_gc_get_allocated_bytes_for_current_thread (void) info = mono_thread_info_current (); /*There are some more allocated bytes in the current tlab that have not been recorded yet */ - return info->total_bytes_allocated + info->tlab_next - info->tlab_start; + return info->total_bytes_allocated + (ptrdiff_t)(info->tlab_next - info->tlab_start); } guint64 |