mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 18:15:18 -07:00
Use the same memory limit everywhere
This commit is contained in:
parent
9567bbe65f
commit
06f331d153
File diff suppressed because one or more lines are too long
@ -23,8 +23,8 @@
|
|||||||
#include "sodium.h"
|
#include "sodium.h"
|
||||||
#include "quirks.h"
|
#include "quirks.h"
|
||||||
|
|
||||||
#ifndef TOTAL_MEMORY_TESTS
|
#ifndef MAX_MEMORY_TESTS
|
||||||
# define TOTAL_MEMORY_TESTS 16777216
|
# define MAX_MEMORY_TESTS 67108864
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
@ -54,7 +54,7 @@ static int set_resource_limits(void)
|
|||||||
#if defined(RLIM_INFINITY) && defined(HAVE_SETRLIMIT)
|
#if defined(RLIM_INFINITY) && defined(HAVE_SETRLIMIT)
|
||||||
struct rlimit limits;
|
struct rlimit limits;
|
||||||
|
|
||||||
limits.rlim_cur = limits.rlim_max = TOTAL_MEMORY_TESTS;
|
limits.rlim_cur = limits.rlim_max = MAX_MEMORY_TESTS;
|
||||||
# ifdef RLIMIT_AS
|
# ifdef RLIMIT_AS
|
||||||
res |= setrlimit(RLIMIT_AS, &limits);
|
res |= setrlimit(RLIMIT_AS, &limits);
|
||||||
# endif
|
# endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
MAX_MEMORY_MB="128"
|
MAX_MEMORY_TESTS_MB="64"
|
||||||
|
|
||||||
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then
|
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then
|
||||||
if command -v wasmtime >/dev/null; then
|
if command -v wasmtime >/dev/null; then
|
||||||
@ -11,9 +11,9 @@ fi
|
|||||||
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "lucet" ]; then
|
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "lucet" ]; then
|
||||||
if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then
|
if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then
|
||||||
lucetc-wasi \
|
lucetc-wasi \
|
||||||
--reserved-size "${MAX_MEMORY_MB}MiB" \
|
--reserved-size "${MAX_MEMORY_TESTS_MB}MiB" \
|
||||||
-o "${1}.so" --opt-level best "$1" &&
|
-o "${1}.so" --opt-level best "$1" &&
|
||||||
lucet-wasi --dir=.:. --max-heap-size "${MAX_MEMORY_MB}MiB" "${1}.so" &&
|
lucet-wasi --dir=.:. --max-heap-size "${MAX_MEMORY_TESTS_MB}MiB" "${1}.so" &&
|
||||||
rm -f "${1}.so" && exit 0
|
rm -f "${1}.so" && exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user