Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Linux] Change from using /tmp to /dev/shm in MemArena so we don't ca…
…use 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.
  • Loading branch information
Sonicadvance1 committed Aug 23, 2012
1 parent bab9b5d commit be20007
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Common/Src/MemArena.cpp
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -53,7 +54,6 @@ void MemArena::ReleaseSpace()
hMemoryMapping = 0;
#else
close(fd);
unlink(ram_temp_file);
#endif
}

Expand Down

0 comments on commit be20007

Please sign in to comment.