mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Naive fix for mremap, without virtual space reservation
This commit is contained in:
parent
8df129b518
commit
7cf72986e8
1 changed files with 7 additions and 2 deletions
|
|
@ -277,9 +277,10 @@ void compact_phase (size_t additional_size) {
|
|||
size_t next_heap_pseudo_size = MAX(next_heap_size, heap.size);
|
||||
|
||||
memory_chunk old_heap = heap;
|
||||
heap.begin = mremap(heap.begin, WORDS_TO_BYTES(heap.size), WORDS_TO_BYTES(next_heap_pseudo_size), MREMAP_MAYMOVE);
|
||||
heap.begin = mmap(NULL, WORDS_TO_BYTES(next_heap_pseudo_size), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
memcpy(heap.begin, old_heap.begin, WORDS_TO_BYTES(old_heap.size));
|
||||
if (heap.begin == MAP_FAILED) {
|
||||
perror("ERROR: compact_phase: mremap failed\n");
|
||||
perror("ERROR: compact_phase: mmap failed\n");
|
||||
exit(1);
|
||||
}
|
||||
heap.end = heap.begin + next_heap_pseudo_size;
|
||||
|
|
@ -290,6 +291,10 @@ void compact_phase (size_t additional_size) {
|
|||
physically_relocate(&old_heap);
|
||||
|
||||
heap.current = heap.begin + live_size;
|
||||
// if (munmap(old_heap.begin, old_heap.size) < 0) {
|
||||
// perror("ERROR: compact_phase: munmap failed\n");
|
||||
// exit(1);
|
||||
// }
|
||||
}
|
||||
|
||||
size_t compute_locations () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue