‹ BackHN Continuity

Thread

Jemalloc 5.4.0

339 points · 94 comments · gkfasdfasdf

  1. ZenoArrow · · focus · HN ↗
    Why is this on the HN front page? Is there something particularly noteworthy about this release?
    1. baq · · focus · HN ↗
      jemalloc is something you should be aware of if you do software for a living
      1. stackghost · · focus · HN ↗
        In the Before Times, the vast majority of software was written in garbage collected language where a working knowledge of the relative merits of C memory allocators is not useful or particularly relevant.

        Why would the scads of people writing JavaScript, Java, python, go, rails, etc need to be aware of jemalloc?

        1. nh2 · · focus · HN ↗
          Memory allocation behaviour has visible impact also for users of managed languages, and the behaviour of software for end users.

          In our Python program, a bit of numpy processing of large pictures led to 100 GB not being returned to the OS by glibc's default allocator and the machine running out of memory shortly after. With jemalloc's reliable memory return settings, those problems disappear.

          1. majora2007 · · focus · HN ↗
            I'm in the same boat, I just switched to using it for Kavita, which only does some basic open Image -> Thumbnail to smaller size -> write to disk when importing new comics/books and on linux, memory could swell to 10GB and never get released. Switched to jemalloc and instantly memory stayed well below 1GB.
            1. nh2 · · focus · HN ↗
              Generally yes, but the wording of "instantly" begs for the following pedantic remark:

              This is controlled by jemalloc settings `dirty_decay_ms`, `muzzy_decay_ms`, and their interaction with `background_thread`.

              `dirty_decay_ms` currently defaults to 10 seconds, so it's not that instant.

              That is important e.g. for single-threaded programs that start other programs, such as my Python example: If it starts a subprocess before the 10 seconds elapse after `free()`, Python (and jemalloc) do not run, and get no chance to return memory to the OS.

              In such cases, either enable `background_thread`, or set the `_decay_` values to `0` to ensure immediate return to the OS upon `free()`. (This costs some performance.)

              See e.g. <a href="https:&#x2F;&#x2F;github.com&#x2F;jemalloc&#x2F;jemalloc&#x2F;issues&#x2F;2688" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jemalloc&#x2F;jemalloc&#x2F;issues&#x2F;2688

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.