diff options
| author | Jay Foad <jay.foad@gmail.com> | 2014-12-18 16:24:01 +0000 |
|---|---|---|
| committer | Jay Foad <jay.foad@gmail.com> | 2014-12-18 16:24:01 +0000 |
| commit | d348d7c757164c3568fd44023e5d0e984d068ef5 (patch) | |
| tree | 6803f0c5e03f03af197ac91cd70ec89efa090a25 /compiler-rt/lib | |
| parent | 0b5a8520acf222bfd6e9f269f7ae722efa5804db (diff) | |
| download | bcm5719-llvm-d348d7c757164c3568fd44023e5d0e984d068ef5.tar.gz bcm5719-llvm-d348d7c757164c3568fd44023e5d0e984d068ef5.zip | |
[Sanitizer] Fix GetRSS on Linux with non-4k pages
Summary:
The numbers in /proc/self/statm are in pages, not in fixed 4k units.
This fixes Linux/hard_rss_limit_mb_test.cc on my PowerPC64 box which
has 64k pages.
Reviewers: kcc, willschm
Reviewed By: willschm
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6717
llvm-svn: 224522
Diffstat (limited to 'compiler-rt/lib')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index 7675315a2bd..330fb98a3ec 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -432,7 +432,7 @@ uptr GetRSS() { buf[len] = 0; // The format of the file is: // 1084 89 69 11 0 79 0 - // We need the second number which is RSS in 4K units. + // We need the second number which is RSS in pages. char *pos = buf; // Skip the first number. while (*pos >= '0' && *pos <= '9') @@ -444,7 +444,7 @@ uptr GetRSS() { uptr rss = 0; while (*pos >= '0' && *pos <= '9') rss = rss * 10 + *pos++ - '0'; - return rss * 4096; + return rss * GetPageSizeCached(); } static void GetArgsAndEnv(char*** argv, char*** envp) { |

