purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0.1.34 is showing abnormal debug memory usage information and 2% slower

YamatoSecurity opened this issue · comments

Using 0.1.32 and earlier I would get results like this:

Memory usage stats:
heap stats:    peak      total      freed    current       unit      count
  reserved:    8.5 GiB    8.5 GiB  164.0 MiB    8.4 GiB                        not all freed!
 committed:    7.8 GiB   13.2 GiB    5.6 GiB    7.6 GiB                        not all freed!
     reset:      0          0          0          0                            ok
   touched:  128.5 KiB    3.0 MiB  320.0 GiB -320.0 GiB                        ok
  segments:     20         24         15          9                            not all freed!
-abandoned:      0          0          0          0                            ok
   -cached:      0          0          0          0                            ok
     pages:      0          0        3.0 Mi    -3.0 Mi                         ok
-abandoned:      0          0          0          0                            ok
 -extended:      0
 -noretire:      0
     mmaps:      0
   commits:    3.2 Ki
   threads:     16         16          0         16                            not all freed!
  searches:     0.0 avg
numa nodes:       1
   elapsed:    1957.036 s
   process: user: 13600.437 s, system: 49.359 s, faults: 2223526, rss: 7.6 GiB, commit: 7.8 GiB

But using the 0.1.34 version I get weird results:

Memory usage stats:
heap stats:    peak      total      freed    current       unit      count
  reserved:    8.3 GiB    8.4 GiB  276.0 MiB    8.2 GiB
 committed:    7.8 GiB  154.8 GiB  147.2 GiB    7.6 GiB
     reset:      0          0          0          0                            ok
   touched:   64.2 KiB   43.1 MiB  352.1 GiB -352.1 GiB                        ok
  segments:     39        691        681         10                            not all freed!
-abandoned:      0          0          0          0                            ok
   -cached:      0          0          0          0                            ok
     pages:      0          0        3.0 Mi    -3.0 Mi                         ok
-abandoned:      0          0          0          0                            ok
 -extended:      0
 -noretire:      0
     mmaps:      0
   commits:  125.6 Ki
   threads:     16         16          0         16                            not all freed!
  searches:     0.0 avg
numa nodes:       1
   elapsed:    1924.433 s
   process: user: 13721.656 s, system: 65.406 s, faults: 12445464, rss: 7.7 GiB, commit: 7.8 GiB

The total committed and freed go from 13GB to 154GB.

Also, we noticed that while it uses around 2% less memory, 0.1.34 is 2% slower than 0.1.32.

Thank you for maintaining mimalloc_rust :)

Supplementary information for the above output.
We debug memory usage using the mi-malloc : mi_stats_print_out() function in the code below.

I would appreciate it if you could check it.