mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Add better error message on VirtualAlloc failure on windows.
This commit is contained in:
@@ -65,7 +65,11 @@ static inline void* mmap_allocate(Vmem *vmem, size_t to_allocate)
|
|||||||
{
|
{
|
||||||
size_t to_commit = blocks_to_allocate * COMMIT_PAGE_SIZE;
|
size_t to_commit = blocks_to_allocate * COMMIT_PAGE_SIZE;
|
||||||
void *res = VirtualAlloc(((char*)vmem->ptr) + vmem->committed, to_commit, MEM_COMMIT, PAGE_READWRITE);
|
void *res = VirtualAlloc(((char*)vmem->ptr) + vmem->committed, to_commit, MEM_COMMIT, PAGE_READWRITE);
|
||||||
if (!res) FATAL_ERROR("Failed to allocate more memory.");
|
if (!res)
|
||||||
|
{
|
||||||
|
error_exit("⚠️Fatal Error! The compiler ran out of memory: more than %u MB was allocated from a single memory arena, "
|
||||||
|
"which was rejected. Perhaps you called some recursive macro?", (unsigned)(allocated_after / (1024 * 1024)));
|
||||||
|
}
|
||||||
vmem->committed += to_commit;
|
vmem->committed += to_commit;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user