Code Monkey home page Code Monkey logo

Comments (4)

yinho999 avatar yinho999 commented on May 26, 2024 2

The default allocator does not return unused memory to avoid the performance loss and memory fragmentation that additional system calls would cause. Reddit

Additionally, there is a PR in rust-analyzer repository suggesting a revisit to the use of jemalloc in release build. issue

Despite the advantages, introducing jemalloc into Loco might lead to observation issue resulting in misleading or out of sync memory usage reports in htop.

In my opinion, adding a bref guide in the documentation about switching to different allocator could benefit users seeking max performance. We should also include warning for the observation issue mentioned above.

from loco.

jondot avatar jondot commented on May 26, 2024 2

This is a great suggestion. I think it calls for some kind of "running in production" section in the docs πŸ‘

from loco.

jondot avatar jondot commented on May 26, 2024

This is very interesting! thanks!
I'm wondering what is the reason for the difference? probably that the default allocator prefers keeping things in memory until memory has pressure and then it will release?

from loco.

isaacdonaldson avatar isaacdonaldson commented on May 26, 2024

Just to add to this, as mentioned above, Rust used to ship with the jemalloc allocator by default but it got removed (possibly due to binary size bloat and not supporting as many platforms).

The foundations crate from cloudflare, which has some tools for building networked services, uses jemalloc (https://docs.rs/foundations/latest/foundations/static.JEMALLOC_MEMORY_ALLOCATOR.html).

I point this out just to say that it's not uncommon for rust projects to use an allocator different from the system allocator, and for networked or long running services to use the jemalloc allocator more specifically (where it excels).

(No affiliation with Cloudflare, just an example I found)

from loco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.