aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Meumertzheim <fabian@meumertzhe.im>2022-08-17 18:26:21 +0200
committerFabian Meumertzheim <fabian@meumertzhe.im>2022-08-18 11:30:37 +0200
commit1b6b88353423c15aee62b8f3d1a081ad67f5a66e (patch)
tree24cdc43a3fbbedced33ea1a4c8a53a3598675651
parent8c4f8830a5e69421d7ab835a5409bc41efca61b8 (diff)
downloadjazzer-api-1b6b88353423c15aee62b8f3d1a081ad67f5a66e.tar.gz
driver: Increase default -rss_limit_mb
With -Xmx512m, the ExampleOutOfMemoryFuzzer ran into this failure on macOS: ==19173== ERROR: libFuzzer: out-of-memory (used: 961Mb; limit: 911Mb)
-rw-r--r--driver/src/main/java/com/code_intelligence/jazzer/driver/Driver.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/src/main/java/com/code_intelligence/jazzer/driver/Driver.java b/driver/src/main/java/com/code_intelligence/jazzer/driver/Driver.java
index 45e7b72e..5b107ad8 100644
--- a/driver/src/main/java/com/code_intelligence/jazzer/driver/Driver.java
+++ b/driver/src/main/java/com/code_intelligence/jazzer/driver/Driver.java
@@ -103,8 +103,9 @@ public class Driver {
// the process including Jazzer's native and non-native memory footprint, such that:
// 1. we never reach it purely by allocating memory on the Java heap;
// 2. it is still reached if the fuzz target allocates excessively on the native heap.
- // As a heuristic, we set the overall memory limit to 2 * the maximum size of the Java heap.
+ // As a heuristic, we set the overall memory limit to 2 * the maximum size of the Java heap and
+ // add a fixed 1 GiB on top for the fuzzer's own memory usage.
long maxHeapInBytes = Runtime.getRuntime().maxMemory();
- return "-rss_limit_mb=" + (2 * maxHeapInBytes / (1024 * 1024));
+ return "-rss_limit_mb=" + ((2 * maxHeapInBytes / (1024 * 1024)) + 1024);
}
}