mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improve the error message when running out of memory.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
- Deprecate old `void!` @benchmark and @test functions.
|
||||
- Allow test runners to take String[] arguments.
|
||||
- Added `--lsp` output.
|
||||
- Improve the error message when running out of memory.
|
||||
|
||||
### Fixes
|
||||
- Fix case trying to initialize a `char[*]*` from a String.
|
||||
|
||||
@@ -71,7 +71,11 @@ static inline void* mmap_allocate(Vmem *vmem, size_t to_allocate)
|
||||
#endif
|
||||
void *ptr = ((uint8_t *)vmem->ptr) + vmem->allocated;
|
||||
vmem->allocated = allocated_after;
|
||||
ASSERT0(vmem->size > vmem->allocated);
|
||||
if (vmem->size < allocated_after)
|
||||
{
|
||||
error_exit("Error: The compiler ran out of memory! Over %u MB was allocated from a single memory arena, perhaps "
|
||||
"you called some recursive macro?", (unsigned)(vmem->size / (1024 * 1204)));
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user