microsoft / microsoft/mimalloc
Confusing debug prints
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
When allocating & deleting small memory blocks sequentially, some confusing debug prints appear randomly. The debug message says "pointer might not point to a valid heap region" and "this may be still valid very large allocation (over 64MiB)" but my allocations always smaller than 300 bytes.
Should I ignore this message or it is a bug or am I using the library incorrectly?
```
alloc 272 [0000040000030140]
alloc 16 [00000400000102E0]
alloc 16 [0000040000010300]
alloc 16 [0000040000010320]
alloc 40 [00000400000400C0]
alloc 16 [0000040000010340]
alloc 16 [0000040000010360]
alloc 16 [0000040000010380]
delete 16 [0000040000010380]
alloc 8 [0000040000001550]
alloc 4 [0000040000001560]
alloc 8 [0000040000001570]
alloc 4 [0000040000001580]
delete 64 [0000040000020050]
delete 16 [0000040000010020]
delete 64 [0000040000020000]
delete 16 [0000040000010000]
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0000040000080000
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 0000040000080000 was valid after all)
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0000040000080000
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 0000040000080000 was valid after all)
alloc 248 [0000040000080000]
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 00000400000400F0
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 00000400000400F0 was valid after all)
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 00000400000400F0
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 00000400000400F0 was valid after all)
alloc 32 [00000400000400F0]
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 00000400000103A0
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 00000400000103A0 was valid after all)
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 00000400000103A0
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 00000400000103A0 was valid after all)
alloc 16 [00000400000103A0]
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0000040000040120
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 0000040000040120 was valid after all)
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0000040000040120
> (this may still be a valid very large allocation (over 64MiB))
> mimalloc: warning: (yes, the previous pointer 0000040000040120 was valid after all)
alloc 32 [0000040000040120]
> mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 00000400000103C0
> (this may still be a valid very large allocation (over 64MiB))
alloc 16 [00000400000103C0]
delete 16 [00000400000103C0]
alloc 16 [00000400000103E0]
alloc 64 [0000040000020190]
alloc 16 [0000040000010400]
delete 16 [0000040000010400]
delete 32 [0000040000040120]
delete 16 [00000400000103A0]
delete 32 [00000400000400F0]
delete 248 [0000040000080000]
alloc 248 [0000040000080100]
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the sequential small-allocation pattern and tracing the mi_usable_size warning path. Determine why valid small pointers trigger the large-allocation warning, then verify that the warnings no longer appear incorrectly or that their behavior is documented. The issue names no source files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100