summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@Gmail.com>2012-08-22 23:39:50 -0500
committerRyan Houdek <Sonicadvance1@Gmail.com>2012-08-22 23:39:50 -0500
commitbe200074e9ed151df484d9aba5d7abcb1036c8a8 (patch)
tree8a7b7aece6c4fc8f1d60a9adef285a7f7389426f
parentbab9b5d3ce14c5b9cb55bd34da4851672e287467 (diff)
[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.
-rw-r--r--Source/Core/Common/Src/MemArena.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/MemArena.cpp b/Source/Core/Common/Src/MemArena.cpp
index 782e124e07..12a2585120 100644
--- a/Source/Core/Common/Src/MemArena.cpp
+++ b/Source/Core/Common/Src/MemArena.cpp
@@ -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
}