-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tuning the Linux memory allocator jemallocator
to reduce initial memory usage
#1672
Comments
I couldn't reproduce it on both my macOS and Linux VM. I created an empty directory using My version
Let me know if I missed any details in reproducing it. Also, are you using any custom config/plugins? Can it be reproduced with the default config ( |
I don't have any custom config (there is no
everything seems to be correct I checked also Additional info that might be useful:
|
Could you try the GNU build instead of musl to see if it uses the same amount of memory?
Are you using the official binary on Gentoo or the one from system package manager? — some packages may apply patches during installation
I'm not quite sure - Yazi doesn't manage memory on its own; it uses jemallocator on Linux. But I haven't looked at its source code, so I'm not sure if it allocates more memory for machines with larger memory. Maybe you could try commenting this out Lines 4 to 6 in 631afd0
to build with the system's default allocator and see what happens |
I checked it on Arch linux (from official repo
Yes, it helped! Now it uses 18Mb not only on empty dir but also in As I understand Jemalloc can be configured to use less RAM (maybe TUNING.md, or some other options) |
Nice! I'm glad that we could narrow it down to an issue with If anyone familiar with |
jemallocator
to reduce initial memory usage
with jemalloc enabled and when running _RJEM_MALLOC_CONF='narenas:1' yazi for me it uses 28-29 Mb of RAM jemalloc.3 here is doc about narenas, as I understand memory usage depends on number of CPUs If you ok with this option I think I can create PR with this |
Do you mean creating a shell wrapper for
How many CPUs do you have? Could you see the memory usage with |
No, I want to create [env]
JEMALLOC_SYS_WITH_MALLOC_CONF = "narenas:1" it will bake this string into jemalloc library (and in (JEMALLOC_SYS_WITH_MALLOC_CONF will pass --with-malloc-conf to jeamalloc
8
it is around 30 Mb What's strange is that with |
Thanks for the info! I think I can accept a PR if that works for you. For me, with the same 8-core CPU, after setting |
I'm going to lock this issue because it has been closed for 30 days. ⏳ |
What system are you running Yazi on?
Linux X11
What terminal are you running Yazi in?
st 0.9.2
yazi --debug
outputDid you try the latest nightly build to see if the problem got fixed?
Yes, and I updated the debug information above (
yazi --debug
) to the nightly that I triedDescribe the bug
For me
yazi
uses around 85MB of RAM on an empty directory, I saw in issue #1368 that for others, it only takes about 20-30MB.Is it expected behavior for
yazi
to use so much memory?Minimal reproducer
Anything else?
No response
The text was updated successfully, but these errors were encountered: