mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #113061 from Ivorforce/profile-alloc-fixes
Only call `GodotProfileAlloc` when the allocation actually happened.
This commit is contained in:
commit
56d766a2a7
1 changed files with 2 additions and 2 deletions
|
|
@ -110,9 +110,9 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
|
||||||
} else {
|
} else {
|
||||||
mem = malloc(p_bytes + (prepad ? DATA_OFFSET : 0));
|
mem = malloc(p_bytes + (prepad ? DATA_OFFSET : 0));
|
||||||
}
|
}
|
||||||
GodotProfileAlloc(mem, p_bytes + (prepad ? DATA_OFFSET : 0));
|
|
||||||
|
|
||||||
ERR_FAIL_NULL_V(mem, nullptr);
|
ERR_FAIL_NULL_V(mem, nullptr);
|
||||||
|
GodotProfileAlloc(mem, p_bytes + (prepad ? DATA_OFFSET : 0));
|
||||||
|
|
||||||
if (prepad) {
|
if (prepad) {
|
||||||
uint8_t *s8 = (uint8_t *)mem;
|
uint8_t *s8 = (uint8_t *)mem;
|
||||||
|
|
@ -180,9 +180,9 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
|
||||||
} else {
|
} else {
|
||||||
GodotProfileFree(mem);
|
GodotProfileFree(mem);
|
||||||
mem = (uint8_t *)realloc(mem, p_bytes);
|
mem = (uint8_t *)realloc(mem, p_bytes);
|
||||||
GodotProfileAlloc(mem, p_bytes);
|
|
||||||
|
|
||||||
ERR_FAIL_COND_V(mem == nullptr && p_bytes > 0, nullptr);
|
ERR_FAIL_COND_V(mem == nullptr && p_bytes > 0, nullptr);
|
||||||
|
GodotProfileAlloc(mem, p_bytes);
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue