# How do I use jemalloc with my application?

Jemalloc is an alternative memory allocator that can be significantly more efficient

libjemalloc is installed by default on servers configured since October 10th, 2023. If your server was last configured before that date, you&#39;ll want to update your server to the latest configuration.

To enable Jemalloc, add the following environment variable on the environment page for the app you wish to enable jemalloc.

#### x64 servers

```
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
```

#### ARM servers

```
LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so.2
```

#### Using jemalloc with Ruby

Using `LD_PRELOAD` will specifically run jemalloc in such a way that Ruby would be unaware of it.

However, [running the command](https://github.com/docker-library/ruby/issues/182#issuecomment-457616010) `MALLOC_CONF=stats_print:true ruby -e &quot;exit&quot;` will output statistics if `LD_PRELOAD` was exported correctly.
