diff --git a/lib/config.cpp b/lib/config.cpp
index c1800a74..361e33c3 100644
--- a/lib/config.cpp
+++ b/lib/config.cpp
@@ -175,6 +175,27 @@ static bool checkSerial(const std::string &ser){
 #endif
 #endif
 
+void Util::Config::wipeShm(){
+  DIR *d = opendir("/dev/shm");
+  char fileName[300];
+  struct dirent *dp;
+  uint64_t deleted = 0;
+  if (d){
+    do{
+      errno = 0;
+      if ((dp = readdir(d))){
+        if (strstr(dp->d_name, "Mst")){
+          snprintf(fileName, sizeof(fileName), "/dev/shm/%s", dp->d_name);
+          unlink(fileName);
+          ++deleted;
+        }
+      }
+    }while (dp != NULL);
+    closedir(d);
+  }
+  if (deleted){WARN_MSG("Wiped %" PRIu64 " shared memory file(s)", deleted);}
+}
+
 Util::Config::Config(){
   // global options here
   vals["debug"]["long"] = "debug";
diff --git a/lib/config.h b/lib/config.h
index 819f9e63..a22967b6 100644
--- a/lib/config.h
+++ b/lib/config.h
@@ -37,6 +37,7 @@ namespace Util{
 
   public:
     static void setMutexAborter(void * mutex);
+    static void wipeShm();
     // variables
     static bool is_active;     ///< Set to true by activate(), set to false by the signal handler.
     static bool is_restarting; ///< Set to true when restarting, set to false on boot.
diff --git a/src/controller/controller.cpp b/src/controller/controller.cpp
index eb0eee79..7156ca96 100644
--- a/src/controller/controller.cpp
+++ b/src/controller/controller.cpp
@@ -393,6 +393,14 @@ int main_loop(int argc, char **argv){
     }
     setenv("MIST_CONTROL", "1", 0); // Signal in the environment that the controller handles all children
   }
+
+#ifdef __CYGWIN__
+  // Wipe shared memory, unless NO_WIPE_SHM is set
+  if (!getenv("NO_WIPE_SHM")){
+    Util::Config::wipeShm();
+    setenv("NO_WIPE_SHM", "1", 1);
+  }
+#endif
   
   Controller::readConfigFromDisk();
   Controller::writeConfig();
@@ -642,6 +650,9 @@ int main(int argc, char **argv){
       return main_loop(argc, argv);
     }
     Util::Procs::fork_complete();
+#ifdef __CYGWIN__
+    setenv("NO_WIPE_SHM", "1", 1);
+#endif
     if (pid == -1){
       FAIL_MSG("Unable to spawn controller process!");
       return 2;