Skip to content

Commit 5a05d17

Browse files
committed
mimalloc: avoid excessive memory retention
In commit cfe73e9d (wip: merging from upstream, 2024-12-25), mimalloc introduced a bug where memory is retained excessively. This leads to a problem e.g. when fetching Git for Windows' `main` branch using the i686 variant of Git for Windows because it simply runs out of address space. Fix this as suggested in microsoft/mimalloc#1025 (comment) Signed-off-by: Johannes Schindelin <[email protected]>
1 parent fca69d2 commit 5a05d17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/mimalloc/os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static void mi_os_prim_free(void* addr, size_t size, size_t commit_size) {
166166
void _mi_os_free_ex(void* addr, size_t size, bool still_committed, mi_memid_t memid) {
167167
if (mi_memkind_is_os(memid.memkind)) {
168168
size_t csize = memid.mem.os.size;
169-
if (csize==0) { _mi_os_good_alloc_size(size); }
169+
if (csize==0) { csize = _mi_os_good_alloc_size(size); }
170170
size_t commit_size = (still_committed ? csize : 0);
171171
void* base = addr;
172172
// different base? (due to alignment)

0 commit comments

Comments
 (0)