Skip to content

Commit

Permalink
Use DEBUG_MEMORY_NAME where it's needed
Browse files Browse the repository at this point in the history
DEBUG_MEMORY_NAME can be defined when USE_MEMORY_MONITOR or DEBUG is not
  • Loading branch information
Xottab-DUTY committed Aug 18, 2017
1 parent 9f22b38 commit cee6a56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Layers/xrRender/DetailManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,34 @@ CDetailManager::CDetailManager() : xrc("detail manager")
dm_cache_size = dm_current_cache_size;
dm_fade = dm_current_fade;
ps_r__Detail_density = ps_current_detail_density;
#ifdef USE_MEMORY_MONITOR
#ifdef DEBUG_MEMORY_NAME
cache_level1 = (CacheSlot1**)Memory.mem_alloc(dm_cache1_line * sizeof(CacheSlot1*), "CDetailManager::cache_level1");
#else
cache_level1 = (CacheSlot1**)Memory.mem_alloc(dm_cache1_line * sizeof(CacheSlot1*));
#endif
for (u32 i = 0; i < dm_cache1_line; ++i)
{
#ifdef USE_MEMORY_MONITOR
#ifdef DEBUG_MEMORY_NAME
cache_level1[i] = (CacheSlot1*)Memory.mem_alloc(dm_cache1_line * sizeof(CacheSlot1), "CDetailManager::cache_level1 " + i);
#else
cache_level1[i] = (CacheSlot1*)Memory.mem_alloc(dm_cache1_line * sizeof(CacheSlot1));
#endif
for (u32 j = 0; j < dm_cache1_line; ++j)
new(&cache_level1[i][j]) CacheSlot1();
}
#ifdef USE_MEMORY_MONITOR
#ifdef DEBUG_MEMORY_NAME
cache = (Slot***)Memory.mem_alloc(dm_cache_line * sizeof(Slot**), "CDetailManager::cache");
#else
cache = (Slot***)Memory.mem_alloc(dm_cache_line * sizeof(Slot**));
#endif
for (u32 i = 0; i < dm_cache_line; ++i)
#ifdef USE_MEMORY_MONITOR
#ifdef DEBUG_MEMORY_NAME
cache[i] = (Slot**)Memory.mem_alloc(dm_cache_line * sizeof(Slot*), "CDetailManager::cache " + i);
#else
cache[i] = (Slot**)Memory.mem_alloc(dm_cache_line * sizeof(Slot*));
#endif

#ifdef USE_MEMORY_MONITOR
#ifdef DEBUG_MEMORY_NAME
cache_pool = (Slot *)Memory.mem_alloc(dm_cache_size * sizeof(Slot), "CDetailManager::cache_pool");
#else
cache_pool = (Slot *)Memory.mem_alloc(dm_cache_size * sizeof(Slot));
Expand Down
4 changes: 2 additions & 2 deletions src/xrScriptEngine/script_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ static void* __cdecl luabind_allocator(void* context, const void* pointer, size_
}
if (!pointer)
{
#ifdef DEBUG
#ifdef DEBUG_MEMORY_NAME
return Memory.mem_alloc(size, "luabind");
#else
return Memory.mem_alloc(size);
#endif
}
void* non_const_pointer = const_cast<LPVOID>(pointer);
#ifdef DEBUG
#ifdef DEBUG_MEMORY_NAME
return Memory.mem_realloc(non_const_pointer, size, "luabind");
#else
return Memory.mem_realloc(non_const_pointer, size);
Expand Down

0 comments on commit cee6a56

Please sign in to comment.