This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Commit b685182
accounts-db: fix 8G+ memory spike during hash calculation (#1308)
We were accidentally doing several thousands 4MB allocations - even
during incremental hash - which added up to a 8G+ memory spikes over ~2s
every ~30s.
Fix by using Vec::new() in the identity function. Empirically 98%+
reduces join arrays with less than 128 elements, and only the last few
reduces join large vecs. Because realloc does exponential growth we
don't see pathological reallocation but reduces do at most one realloc
(and often 0 because of exp growth).
(cherry picked from commit 2c71685)
Co-authored-by: Alessandro Decina <[email protected]>
1 parent f2b31bd commit b685182
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
841 | | - | |
842 | | - | |
843 | | - | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
844 | 848 | | |
845 | 849 | | |
846 | 850 | | |
| |||
0 commit comments