Skip to content

Commit

Permalink
Build: Set MALLOC_ARENA_MAX for test processes to reduce memory overhead
Browse files Browse the repository at this point in the history
The glibc default number of memory pools on 64bit systems is 8 times the
number of CPU cores. Choosing a value MALLOC_ARENA_MAX is generally a
tradeoff between performance and memory consumption. Not setting
MALLOC_ARENA_MAX gives the best performance, but may mean higher memory
use. Setting MALLOC_ARENA_MAX to “2” or “1” makes glibc use fewer
memory pools and potentially less memory, but this may reduce
performance.

 #KTI-1609
  • Loading branch information
4u7 authored and Space Team committed Mar 19, 2024
1 parent d31201e commit ec62113
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ fun Project.projectTest(
dependsOn(":test-instrumenter:jar")
}

// The glibc default number of memory pools on 64bit systems is 8 times the number of CPU cores
// Choosing a value MALLOC_ARENA_MAX is generally a tradeoff between performance and memory consumption.
// Not setting MALLOC_ARENA_MAX gives the best performance, but may mean higher memory use.
// Setting MALLOC_ARENA_MAX to “2” or “1” makes glibc use fewer memory pools and potentially less memory,
// but this may reduce performance.
environment("MALLOC_ARENA_MAX", "2")

jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
Expand Down

0 comments on commit ec62113

Please sign in to comment.