|
10 | 10 | // run-time libraries. |
11 | 11 | //===----------------------------------------------------------------------===// |
12 | 12 |
|
| 13 | +#include "sanitizer_allocator.h" |
13 | 14 | #include "sanitizer_allocator_interface.h" |
14 | 15 | #include "sanitizer_common.h" |
15 | 16 | #include "sanitizer_flags.h" |
|
18 | 19 |
|
19 | 20 | namespace __sanitizer { |
20 | 21 |
|
21 | | -static void (*SoftRssLimitExceededCallback)(bool exceeded); |
22 | | -void SetSoftRssLimitExceededCallback(void (*Callback)(bool exceeded)) { |
23 | | - CHECK_EQ(SoftRssLimitExceededCallback, nullptr); |
24 | | - SoftRssLimitExceededCallback = Callback; |
25 | | -} |
26 | | - |
27 | 22 | #if (SANITIZER_LINUX || SANITIZER_NETBSD) && !SANITIZER_GO |
28 | 23 | // Weak default implementation for when sanitizer_stackdepot is not linked in. |
29 | 24 | SANITIZER_WEAK_ATTRIBUTE StackDepotStats StackDepotGetStats() { return {}; } |
@@ -67,13 +62,11 @@ void *BackgroundThread(void *arg) { |
67 | 62 | reached_soft_rss_limit = true; |
68 | 63 | Report("%s: soft rss limit exhausted (%zdMb vs %zdMb)\n", |
69 | 64 | SanitizerToolName, soft_rss_limit_mb, current_rss_mb); |
70 | | - if (SoftRssLimitExceededCallback) |
71 | | - SoftRssLimitExceededCallback(true); |
| 65 | + SetRssLimitExceeded(true); |
72 | 66 | } else if (soft_rss_limit_mb >= current_rss_mb && |
73 | 67 | reached_soft_rss_limit) { |
74 | 68 | reached_soft_rss_limit = false; |
75 | | - if (SoftRssLimitExceededCallback) |
76 | | - SoftRssLimitExceededCallback(false); |
| 69 | + SetRssLimitExceeded(false); |
77 | 70 | } |
78 | 71 | } |
79 | 72 | if (heap_profile && |
|
0 commit comments