Closed daladim closed 2 months ago
I'll try to investigate myself a bit, but I'm sure you'll be quicker than me to figure out what the root cause can be.
I'll chime in here if ever I find anything relevant.
Dup of #478, #486
argon2
has extremely trivial use of the heap with 100% safe code. Please see #478 where we went through all of this already.
However, it does use a large amount of memory, which puts stress on the heap.
You are observing how your memory allocator works, no more.
Thanks for your reply. I could create a minimal reproducer that I filed to the rust-lang repo
Calling Argon2 over and over like that signals to the heap that it should hang on to the memory, rather than releasing it to the OS, because you are making similarly shaped heap allocations over and over, followed by immediately freeing it.
Also note that if you want to experiment with different memory strategies, this API lets you completely manage the memory yourself and avoids all direct heap allocations: https://docs.rs/argon2/latest/argon2/struct.Argon2.html#method.hash_password_into_with_memory
Hello,
I've just realized argon2 is using unexpected amounts of RAM on a Raspberry Pi.
Minimal reproducer
Using the current master branch (@ 21d80b0040e1eff0f8f4e76733fdfd3210bac84a), but I discovered this issue @ 0.5.3.
Results
To run the reproducer (in the
argon2
folder):cargo add memory-stats
andcargo test --all-features -- --nocapture ram_usage
On a Raspberry Pi 5 (aarch64, Raspberry Pi OS 12 Bookworm, rustc 1.81.0 stable):
This is consistent over several Rapsberry Pis I have tried.
However, on the following setups, this test always showed sensible and steady RAM usage: