Skip to content

jemalloc seems to be holding onto enormous quantities of memory, causing the appearance of a memory leak #28699

Closed
@bstrie

Description

@bstrie

@frankmcsherry came in today asking about help diagnosing a memory leak in timely-dataflow. His program was sitting on 7GB (as observed through the system monitor) with no apparent reason. Eventually we guessed that maybe the allocator was being greedy behind the scenes, and that does appear to be the case, as shown by the following program:

fn main() {
    {
        let mut test = Vec::new();

        for i in 0..1000000000 {
            test.push(i);
        }
    }

    loop { }
}

I compiled and ran this program on my Linux machine and observed with top. After escaping the inner scope and reaching the loop, memory continued to hover around 800 MB. This behavior was independent of whether the program was compiled in -O0 or -O3 (though the latter did once fault with an illegal instruction, though this may have just been OOM-killer nondeterminism).

Is there any doubt that this behavior is due to jemalloc? If not, then we should look into providing some way of on-demand requesting that jemalloc dump whatever memory it's gobbled up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocators

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions