mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 06:59:32 +03:00
Merge pull request #450 from bmalrat/FixStatOnWindowsRealloc
Fixed stats in mi_os_mem_alloc_aligned on windows when re-allocate
This commit is contained in:
commit
4b52ce4095
1 changed files with 5 additions and 0 deletions
5
src/os.c
5
src/os.c
|
@ -641,6 +641,11 @@ static void* mi_os_mem_alloc_aligned(size_t size, size_t alignment, bool commit,
|
||||||
mi_os_mem_free(p, over_size, commit, stats);
|
mi_os_mem_free(p, over_size, commit, stats);
|
||||||
void* aligned_p = mi_align_up_ptr(p, alignment);
|
void* aligned_p = mi_align_up_ptr(p, alignment);
|
||||||
p = mi_win_virtual_alloc(aligned_p, size, alignment, flags, false, allow_large, is_large);
|
p = mi_win_virtual_alloc(aligned_p, size, alignment, flags, false, allow_large, is_large);
|
||||||
|
if (p != NULL)
|
||||||
|
{
|
||||||
|
_mi_stat_increase(&stats->reserved, size);
|
||||||
|
if (commit) { _mi_stat_increase(&stats->committed, size); }
|
||||||
|
}
|
||||||
if (p == aligned_p) break; // success!
|
if (p == aligned_p) break; // success!
|
||||||
if (p != NULL) { // should not happen?
|
if (p != NULL) { // should not happen?
|
||||||
mi_os_mem_free(p, size, commit, stats);
|
mi_os_mem_free(p, size, commit, stats);
|
||||||
|
|
Loading…
Add table
Reference in a new issue