Skip to content

Commit

Permalink
return prlimit for gcc, it was not its fault
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzm committed Apr 6, 2021
1 parent 29cf5bd commit f968f6b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Expand Up @@ -78,15 +78,20 @@ include (cmake/find/ccache.cmake)
# Another way would be to use --ccache-skip option before clang++-11 to make
# ccache ignore it.
option(ENABLE_CHECK_HEAVY_BUILDS "Don't allow C++ translation units to compile too long or to take too much memory while compiling." OFF)
# gcc10/gcc10/clang -fsanitize=memory is too heavy
if (ENABLE_CHECK_HEAVY_BUILDS AND NOT (SANITIZE STREQUAL "memory" OR COMPILER_GCC))
if (ENABLE_CHECK_HEAVY_BUILDS)
# set DATA (since RSS does not work since 2.6.x+) to 2G
set (RLIMIT_DATA 5000000000)
# set VIRT (RLIMIT_AS) to 10G (DATA*10)
set (RLIMIT_AS 10000000000)
# set CPU time limit to 600 seconds
set (RLIMIT_CPU 600)
set (CMAKE_CXX_COMPILER_LAUNCHER prlimit --verbose --as=${RLIMIT_AS} --data=${RLIMIT_DATA} --cpu=${RLIMIT_CPU} ${CMAKE_CXX_COMPILER_LAUNCHER})

# gcc10/gcc10/clang -fsanitize=memory is too heavy
if (SANITIZE STREQUAL "memory" OR COMPILER_GCC)
set (RLIMIT_DATA 10000000000)
endif()

set (CMAKE_CXX_COMPILER_LAUNCHER prlimit --as=${RLIMIT_AS} --data=${RLIMIT_DATA} --cpu=${RLIMIT_CPU} ${CMAKE_CXX_COMPILER_LAUNCHER})
endif ()

if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None")
Expand Down

0 comments on commit f968f6b

Please sign in to comment.