Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are plenty of malloc alternatives (tcmalloc,jemalloc, etc)— and yet I'm not aware of any that has bothered with a realloc_only_if_you_dont_need_to_move(). I'm not aware of any higher level language construct that reduces to that— where your program flow changes depending on details of the systems memory management. If this were an interesting case, I would have thought someone would have implemented it somewhere.

Seems to me that you're making a weird strawman argument there.



This isn't a detail of systems memory management, this is "all my pointers just moved to a different place". You can't really get something more major!

You can't use realloc on C++ types (which typically need their constructors/destructors running without their memory address moving underneath them). I've written C types which had similar behaviour, and were not happy about being moved. Of course you can (and people do) write code which will after the move go through and do fix-ups, but it is often move pleasant to do the move yourself, if an in-place move isn't going to work.




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

Search: