Skip to content

Commit e262a9f

Browse files
committed
lua now can run "life.lua" test without running out-of-memory. Now
Lua can properly use all the system memory available.
1 parent bb70433 commit e262a9f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/mem.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ void *malloc(size_t size)
3030
}
3131

3232
if (size <= malloc_arena_thresh)
33+
{
3334
p = _fmalloc(size);
34-
else p = fmemalloc(size);
35+
if (p == NULL)
36+
{
37+
__dprintf("HEAP full: allocating from far memory %u\n", size);
38+
p = fmemalloc(size);
39+
}
40+
}
41+
else
42+
p = fmemalloc(size);
3543
return p;
3644
}
3745

0 commit comments

Comments
 (0)