18 karma · joined Jul 19, 2020 (6y ago) · 7 submissions
comment 6y ago · link · parent
Yup. I know it's easy and the default behavior in C++.
This Haskell page says, it is pretty common to allocate and deallocate memory immediately, and that GHC handles this pretty efficiently, which probably explains why Haskellers dont seem to care about this (though it seems weird to me).
comment 6y ago · link · parent
That sounds interesting and will probably make it more efficient. But how do I put things on the stack? As per this answer on Stackoverflow, the runtime allocates memory on the heap to call functions (and probably programmers don't have any control over that?):
comment 6y ago · link · parent
1) If it allocates, why does `top` not show it?
2) Why does it allocate SO MUCH when it uses only a fraction? Looks like a very bad strategy to allocate 2800 times more memory than actually used?
comment 6y ago · link · parent
If anyone knows the exact reason for that, then please enlighten me as well. Even this otherwise awesome tutorial ignores that value: https://youtu.be/R47959rD2yw?t=1306
comment 6y ago · link · parent
comment 6y ago · link · parent