Added mremap syscall tracing in the MemoryLimitListener to catch when the memory limit is exceeded and report a "memory limit exceeded" error instead of returning another possibly unrelated error (segfault, non-zero error code).
I also fixed a bug that caused the error ''memory limit exceeded'' to be displayed when there was no memory limit.
The error was caused by allocating more than MEMORY_LIMIT_MARGIN/2 bytes of memory in a single mmap call, which resulted in post-allocation memory usage being compared to the memory limit(which was zero).
Added mremap syscall tracing in the MemoryLimitListener to catch when the memory limit is exceeded and report a "memory limit exceeded" error instead of returning another possibly unrelated error (segfault, non-zero error code).
I also fixed a bug that caused the error ''memory limit exceeded'' to be displayed when there was no memory limit. The error was caused by allocating more than
MEMORY_LIMIT_MARGIN/2
bytes of memory in a single mmap call, which resulted in post-allocation memory usage being compared to the memory limit(which was zero).