rust-lang / rust-lang/rust

Deallocating large BTreeMap takes very long time

Open
#126,145 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-optimization I-slow S-needs-repro
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

When deallocating large BTreeMap takes very long time. Deallocating a BTreeMap with 15GB size with 60M elements(each element is 250 byte) takes around 20 seconds on my computer.
In my plogram, when code is exiting, that deallocating occures and takes long time. But in that case, deallocating is not needed because just freeing all allocated memory pages by os is enough.

Contributor guide

Open the contributing guide

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

The issue does not name a source file, test, or entry point. Start by reproducing the reported BTreeMap deallocation case with a 15GB map containing 60M 250-byte elements, then investigate process-exit cleanup behavior. Done means the reported exit-time delay is addressed without compromising normal BTreeMap deallocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Bug
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.