Hacker News new | past | comments | ask | show | jobs | submit login

It doesn't work very well and can't be made to work better. free()ing memory doesn't return memory to the system fast enough and it's easy to accidentally create more memory pressure while trying to respond to this (like by touching a page that's compressed/swapped out).

The only safe thing you can do is free entire pages at once, but that's not necessarily effective.

That's why iOS typically just kills you instead.




Of course you can only return pages at a time. That is the minimum size virtual memory works in.

You don't want malloc to instantly release memory to the system on free(), and malloc() is then constrained by the same page multiple at a time restriction as anything else so it can't release fragmented memory.

What you should be doing is trying to save state so that you can return to original state, not fighting to keep going.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: