News for hackers. Stuff that matters.
Re:Lessons in Managing Haskell Memory by AnimalMuppet on Thursday April 09, 2020 @01:07PM (#22824721)
You're almost trying to do C++ memory management, but do it in Haskell. This seems almost like masochism.
Re:Lessons in Managing Haskell Memory by kccqzy on Thursday April 09, 2020 @04:20PM (#22826774)
I think that, for many applications that need to deal with a large heap written in a GC'd language, sooner or later people realize the GC just isn't a good fit and reinvent manual memory management. This is the same regardless of whether you choose Haskell or Java or Go. Even in Java world you can find plenty of evidence that people find GC + large heap unsatisfactory and resort to alternatives like memory-mapped files or JNI or just moving the data out of the process. Same thing with Go. I wouldn't call it masochism.
Re:Lessons in Managing Haskell Memory by AnimalMuppet on Thursday April 09, 2020 @05:09PM (#22827230)
"Any sufficiently complicated program in a garbage-collected language contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of malloc and free"?
Re:Lessons in Managing Haskell Memory by zozbot234 on Thursday April 09, 2020 @01:25PM (#22824938)
True C++/Rusty memory management would require being able to add+remove GC roots from within GC-compact regions as well. Then any object within a GC-compact region could be made to point safely to any object outside of it by simply promoting that object to a GC root, and undoing that promotion as the reference is dropped. In essence this would completely decouple the two styles of memory management while still allowing them to interact appropriately.