Cysharp / Cysharp/MemoryPack

Support a custom ArrayPool

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

Nobody has claimed this yet.

Dominant language
C#
Stars
4.7k
Forks
313
PR merge metrics
No merged PRs in 30d

Description

I serialize/deserialize very large arrays with MemoryPack (>1GB) (as part of a complicated object graph).

It looks like MemoryPack uses ArrayPool.Shared, which means that after MemoryPack is done, these arrays hang around in memory for the life of the process, with no way to retire them.

If I could specify a custom ArrayPool somewhere, somehow, I could manage the lifetime of these arrays.

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 locating the ArrayPool.Shared usage in MemoryPack's serialization and deserialization paths, then trace how array allocation is configured. The work is done when callers can provide a custom ArrayPool and large temporary arrays no longer require the shared pool; add or update coverage for custom-pool usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.