Adding support for tagging individual allocs

オープン
#1,193 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
c

調査の方向性

まず、既存の new/malloc インターフェース、allocation ヘッダー、deallocation パス、および issue で言及されている tracking API を確認します。現在の allocation インターフェースを壊さずに、thread-local タグをどのように割り当てて保持するかを決定します。tagging の設計、メタデータの保存、deallocation の動作、tracking 統計が仕様化され、適切な検証とともに実装されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hi @daanx and others!

I was wondering if anyone has ever implemented, or extended mimalloc in ways that it can support tagging - e.g. maybe initially just a custom provided byte, or word, dword that marks the block in a way.

Now I know this comes with few gotchas - existing new/malloc interfaces do not have this, so it has to be a threadlocal "global" (not ideal), but that would be acceptable for our use case. We can have some RAII controlled scopes pushing and popping threadlocal tags.

Then later, through a tracking API we can expose some stats and have IMG1 tag used this amount of bytes, etc.

The nasty bit here, is that this would require reading bits from the header just before that memory block is going to be deallocated... unless some scheme to keep tags on the side.

More or less, something that mimics Microsoft's Kernel ExAllocatePoolXxx functions - https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-exallocatepool2

Just pondering on ideas, thoughts before diving in.

主要言語
C
スター
13.6k
フォーク
1.2k
平均マージ
18時間 12分
マージ済み PR(30日)
20

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/mimalloc のほかの issue

microsoft/mimalloc の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。