microsoft / microsoft/snmalloc

Implement accurate size storage for Windows `_msize` and `_recalloc`

Open
#786 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
C++
Stars
2k
Forks
138
Avg merge
11h 19m
Merged PRs (30d)
5

Description

With snmalloc we can provide a custom meta-data per object that is attached to the standard snmalloc meta-data such as free lists.

https://github.com/microsoft/snmalloc/blob/012138e29f8802157ee430b68a1c64f0ef3fbe0b/src/snmalloc/backend_helpers/commonconfig.h#L89-L103

We could use this feature to store a single bit per object. The bit being set means the allocation does not consume the whole allocated space. The last byte then represents how much space is not being used by the allocation, i.e. 17 byte allocation, would have the last byte as 15 (32 - 17) and the bit would be set, whereas a 32 byte allocation would not have the bit set.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the custom per-object metadata support in src/snmalloc/backend_helpers/commonconfig.h, then trace the Windows implementations of _msize and _recalloc. Determine how the proposed bit and final-byte encoding can represent unused allocation space. Done means Windows size reporting and reallocation use accurate object sizes, with relevant behavior verified by the project’s existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.