Skip to content

leak in Rust std::os::fs on OS X? (DefaultMallocZone) #11027

Closed
@killerswan

Description

@killerswan

I have a program which causes a fairly large leak over time on OS X, and it seems to be due to (repeatedly) traversing and stating a directory which includes a ./.git/ repo.

Check out this repo to this commit:

$ git checkout 94e28dc566780040

Build testloop.

$ make

Run it.

$ ./bin/testloop src/demo.rs

Observe it using the leaks program.

$ leaks 40604 | head -17
Process:         testloop [40604]
Path:            /Users/kevin/code/meow/bin/testloop
Load Address:    0x100fc6000
Identifier:      testloop
Version:         0
Code Type:       X86-64
Parent Process:  bash [85280]

Date/Time:       2013-12-17 05:53:11.663 -0800
OS Version:      Mac OS X 10.9 (13A603)
Report Version:  7

leaks Report Version:  2.0
Process 40604: 2647 nodes malloced for 2983 KB
Process 40604: 2109 leaks for 539904 total leaked bytes.
Leak: 0x7fbc42406e20  size=256  zone: DefaultMallocZone_0x1012ef000
    0x00000000 0x80000000 0x00000000 0x80000000     ................

It is all this DefaultMallocZone.

$ leaks 40604 | sed -e 's/0x.*size=/ size=/' -e 's/.*0x.*0x.*0x.*0x.*//' | sort | uniq -c
...
8647 Leak:  size=256  zone: DefaultMallocZone_0x1012ef000
...

Something about our allocation patterns is bad? Or something specific in the libraries? (~10 MB per hour bad?)

It is interesting that in the next commit, where I limit the program to polling in the src directory (containing like two files instead of a couple hundred) the leak appears to go away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions