SpacemanDMM
SpacemanDMM copied to clipboard
The memory usage is too high
language server peaks at 1.1G RSS parsing /tg/station, idles at 580M on glibc and 1.0G on musl despite low utilization
probably heap fragmentation:
- on glibc, 10% of RSS is overhead
- on musl, 45% of RSS is overhead
tried throwing away some unnecessary data (bd255d1), which reduces in-use memory by 70% but doesn't reduce RSS at all:
- on glibc, 73% of RSS is overhead
- on musl, 85% of RSS is overhead
musl changed something and my builds are now hovering at more like 610MB RSS on /tg/station which is a lot closer to acceptable
A recent series of commits has helped significantly. The following comparison is with x86_64-unknown-linux-gnu/debug. x86_64-unknown-linux-musl/release is a little worse both before and after, but the magnitude of the improvement is about the same.
Before, 66d4b82972530b6d396611e44f33c5dc504fdf86
- sizeof(Statement) = 664
- sizeof(Expression) = 192
- sizeof(Term) = 128
- langserver idle @ 952 MB
- lint massif peak @ 859 MB
- parse 3.877s - references 0.554s - dreamchecker 1.364s - diagnostics 0.008s - total 5.805s
After, 13fd304f04516efd080d83c69f7aab82ac1f1d27
- sizeof(Statement) = 104
- sizeof(Expression) = 64
- sizeof(Term) = 88
- langserver idle @ 533 MB (44% reduction)
- lint massif peak @ 463 MB (46% reduction)
- parse 3.474s - references 0.565s - dreamchecker 1.353s - diagnostics 0.006s - total 5.400s
Whatever happened to make this worse while I wasn't looking, I fought it off a bit again:
- sizeof(Statement) = 88
- sizeof(Expression) = 48
- sizeof(Term) = 64
- langserver idle on /tg/station13 from 648 MB to 537 MB
- sizeof(Statement) = 56
- sizeof(Expression) = 32
- sizeof(Term) = 40
- langserver idle on /tg/station13 is 418 MB
Have you measured the impact from identifiers and string literals? I'm not sure about the strings, but for identifiers there are many savings to potentially be made by sharing the allocation of duplicate names.