Browse Source

-DDISABLE_ALLOCATOR now disables memory recycling.

David Piuva 4 years ago
parent
commit
4ec17d4164
1 changed files with 7 additions and 3 deletions
  1. 7 3
      Source/DFPSR/base/allocator.cpp

+ 7 - 3
Source/DFPSR/base/allocator.cpp

@@ -1,4 +1,8 @@
-
+
+// This allocator does not have any header and can be disabled by not linking it into the application
+// or by defining DISABLE_ALLOCATOR (usually with a -DDISABLE_ALLOCATOR compiler flag).
+#ifndef DISABLE_ALLOCATOR
+
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
@@ -6,8 +10,6 @@
 
 
 static std::mutex allocationLock;
 static std::mutex allocationLock;
 
 
-// This allocator does not have any header and can be disabled by not linking it into the application
-
 // Allocation head stored in the beginning of each allocation
 // Allocation head stored in the beginning of each allocation
 // The caller's content begins alignedHeadSize bytes after the head
 // The caller's content begins alignedHeadSize bytes after the head
 struct AllocationHead {
 struct AllocationHead {
@@ -133,3 +135,5 @@ void operator delete(void* content) {
 		}
 		}
     allocationLock.unlock();
     allocationLock.unlock();
 }
 }
+
+#endif