andrew-johnson-4 / lambda-mountain

Compact Portable Assembler (5K SLOC)
MIT License
12 stars 0 forks source link

Fix Memory Leak in Compile #442

Closed andrew-johnson-4 closed 3 weeks ago

andrew-johnson-4 commented 1 month ago

Fix Memory Leak in Compile

Parse Memory: 2254360
Parse Memory: 3318685
Parse Memory: 3550415
Parse Memory: 4172510
Parse Memory: 4242092
Parse Memory: 4940764
Parse Memory: 5816199
Parse Memory: 6316315
Parse Memory: 7182689
Parse Memory: 10975061
Parse Memory: 11160205
Parse Memory: 12049336
Parse Memory: 14402135
Parse Memory: 15857080
Parse Memory: 15972298
Parse Memory: 17555590
Parse Memory: 17679865
Parse Memory: 17688961
Preprocess Memory: 119783088
Typecheck Memory: 421119714
Compile Memory: 3307039097

Sort of high across the board, but really bad in compilation.

andrew-johnson-4 commented 1 month ago

I think this is related to unnecessary closes that were required to evade the missing feature of large returns. To fix this it is important to understand that opens are free but only close costs memory.

andrew-johnson-4 commented 1 month ago

This is probably 95% coming from unification attempts in lookup.

andrew-johnson-4 commented 4 weeks ago

Next suspect is chain maybe?

andrew-johnson-4 commented 4 weeks ago

Somewhere unify-ctx is too heavy. This seems to be a big factor still.