From be200074e9ed151df484d9aba5d7abcb1036c8a8 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 22 Aug 2012 23:39:50 -0500 Subject: [PATCH] [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. --- Source/Core/Common/Src/MemArena.cpp | 4 ++-- 1 file 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 }