Browse Source

Fix static init ordering issue with the runtime build

rdb 14 years ago
parent
commit
d290a193ad
1 changed files with 4 additions and 4 deletions
  1. 4 4
      dtool/src/dtoolbase/neverFreeMemory.cxx

+ 4 - 4
dtool/src/dtoolbase/neverFreeMemory.cxx

@@ -25,10 +25,6 @@ static const size_t min_page_remaining_size = 16;
 // We always allocate at least this many bytes at a time.
 static const size_t min_page_size = 128 * 1024;  // 128K
 
-// We always allocate integer multiples of this many bytes, to
-// guarantee this minimum alignment.
-static const size_t alignment_size = MemoryHook::get_memory_alignment();
-
 ////////////////////////////////////////////////////////////////////
 //     Function: NeverFreeMemory::Constructor
 //       Access: Private
@@ -49,6 +45,10 @@ void *NeverFreeMemory::
 ns_alloc(size_t size) {
   _lock.acquire();
 
+  // We always allocate integer multiples of this many bytes, to
+  // guarantee this minimum alignment.
+  static const size_t alignment_size = MemoryHook::get_memory_alignment();
+
   // Round up to the next alignment_size.
   size = ((size + alignment_size - 1) / alignment_size) * alignment_size;