[Linux] Change from using /tmp to /dev/shm in MemArena so we don't cause any disk IO, also unlink file while it is open to allow multiple instances running. This was discussed months ago, but was never implemented for whatever reason.
This commit is contained in:
parent
bab9b5d3ce
commit
be200074e9
|
@ -30,7 +30,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static const char* ram_temp_file = "/tmp/gc_mem.tmp";
|
static const char* ram_temp_file = "/dev/shm/gc_mem.tmp";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MemArena::GrabLowMemSpace(size_t size)
|
void MemArena::GrabLowMemSpace(size_t size)
|
||||||
|
@ -40,6 +40,7 @@ void MemArena::GrabLowMemSpace(size_t size)
|
||||||
#else
|
#else
|
||||||
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||||
fd = open(ram_temp_file, O_RDWR | O_CREAT, mode);
|
fd = open(ram_temp_file, O_RDWR | O_CREAT, mode);
|
||||||
|
unlink(ram_temp_file);
|
||||||
ftruncate(fd, size);
|
ftruncate(fd, size);
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +54,6 @@ void MemArena::ReleaseSpace()
|
||||||
hMemoryMapping = 0;
|
hMemoryMapping = 0;
|
||||||
#else
|
#else
|
||||||
close(fd);
|
close(fd);
|
||||||
unlink(ram_temp_file);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue