Add d_m3MaxLinearMemoryPages

extensions
Volodymyr Shymanskyy 3 years ago
parent ce6e61e009
commit 3649e3f441

@ -24,6 +24,10 @@
# define d_m3MaxFunctionStackHeight 2000 // TODO: comment on upper limit
# endif
# ifndef d_m3MaxLinearMemoryPages
# define d_m3MaxLinearMemoryPages 32768
# endif
# ifndef d_m3MaxFunctionSlots
# define d_m3MaxFunctionSlots ((d_m3MaxFunctionStackHeight)*2)
# endif

@ -372,7 +372,11 @@ M3Result ResizeMemory (IM3Runtime io_runtime, u32 i_numPages)
{
size_t numPageBytes = numPagesToAlloc * d_m3MemPageSize;
// Limit the amount of memory that gets allocated
#if d_m3MaxLinearMemoryPages > 0
_throwif("linear memory limitation exceeded", numPagesToAlloc > d_m3MaxLinearMemoryPages);
#endif
// Limit the amount of memory that gets actually allocated
if (io_runtime->memoryLimit) {
numPageBytes = M3_MIN (numPageBytes, io_runtime->memoryLimit);
}

Loading…
Cancel
Save