diff --git a/dtool/src/dtoolbase/neverFreeMemory.cxx b/dtool/src/dtoolbase/neverFreeMemory.cxx index 194d36fd96..9779e75976 100644 --- a/dtool/src/dtoolbase/neverFreeMemory.cxx +++ b/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;