try it with a smaller alloc
This commit is contained in:
parent
e89d9f9134
commit
db4fd66eaf
1 changed files with 3 additions and 2 deletions
|
|
@ -32,8 +32,9 @@ static void test_tt_registry(void) {
|
||||||
|
|
||||||
// perform a big allocation during parsing to trigger out-of-memory handling
|
// perform a big allocation during parsing to trigger out-of-memory handling
|
||||||
static HParsedToken *act_big_alloc(const HParseResult *r, void *user) {
|
static HParsedToken *act_big_alloc(const HParseResult *r, void *user) {
|
||||||
void *buf = h_arena_malloc(r->arena, 1024*1024*1024);
|
void *buf = h_arena_malloc(r->arena, 500*1024*1024);
|
||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
|
g_test_message("Memory allocation was supposed to fail");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
static void test_oom(void) {
|
static void test_oom(void) {
|
||||||
|
|
@ -44,7 +45,7 @@ static void test_oom(void) {
|
||||||
int i;
|
int i;
|
||||||
i = getrlimit(RLIMIT_DATA, &bak);
|
i = getrlimit(RLIMIT_DATA, &bak);
|
||||||
assert(i == 0);
|
assert(i == 0);
|
||||||
lim.rlim_cur = 1000*1024*1024; // never enough
|
lim.rlim_cur = 499*1024*1024; // never enough
|
||||||
if(lim.rlim_cur > bak.rlim_max)
|
if(lim.rlim_cur > bak.rlim_max)
|
||||||
lim.rlim_cur = bak.rlim_max;
|
lim.rlim_cur = bak.rlim_max;
|
||||||
lim.rlim_max = bak.rlim_max;
|
lim.rlim_max = bak.rlim_max;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue