[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:
Ryan Houdek 2012-08-22 23:39:50 -05:00
parent bab9b5d3ce
commit be200074e9
1 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@
#endif
#ifndef _WIN32
static const char* ram_temp_file = "/tmp/gc_mem.tmp";
static const char* ram_temp_file = "/dev/shm/gc_mem.tmp";
#endif
void MemArena::GrabLowMemSpace(size_t size)
@ -40,6 +40,7 @@ void MemArena::GrabLowMemSpace(size_t size)
#else
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
fd = open(ram_temp_file, O_RDWR | O_CREAT, mode);
unlink(ram_temp_file);
ftruncate(fd, size);
return;
#endif
@ -53,7 +54,6 @@ void MemArena::ReleaseSpace()
hMemoryMapping = 0;
#else
close(fd);
unlink(ram_temp_file);
#endif
}