microsoft / microsoft/snmalloc

malloc_history equivalent

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

Nobody has claimed this yet.

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

Description

The Darwin malloc implementation has a feature (enabled by an environment variable) that records, for each allocation or deallocation event:

  • The size of the allocation.
  • The address of the allocation.
  • The thread ID for the [de]allocation call.
  • A stack trace at the [de]allocation site.

This makes it possible for after a crash to determine where an allocation originated and where it was freed.

Implementing similar functionality in snmalloc (ideally using ifunc logic to replace the malloc / free functions at load time) could reuse some of the compressed stack trace logic from the LLVM sanitisers.

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

No files, tests, or entry points are identified. Start by reading snmalloc's allocator and the compressed stack-trace logic in the LLVM sanitizers, then investigate how malloc/free could be intercepted at load time. Done means an agreed design and implementation that records allocation and deallocation size, address, thread ID, and stack trace for post-crash analysis.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.