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

My usual argument is as follows:

There are indeed cases where you have to use GC on some part of your program (as you say, some graph with cycles). However, such things are still only a small part of a program, and most of your memory allocations can still be handled without a GC.

No program language I am aware of (and I don't claim to know all) are good at saying "GC this 5%, I'll explicitly handle everything else". In C++ the "GC" bit is painful, in most other languages the "I'll do everything else" bit is painful.

Of course, there is an argument that just GCing everything is as efficient as bothering with manual memory management, so why bother at all? I'm still to be convinced about that, particularly because GC systems tend to want to use quite a bit more memory, so they have room to breathe.



> No program language I am aware of (and I don't claim to know all) are good at saying "GC this 5%, I'll explicitly handle everything else"

I haven't used rust in production, but I think it allows you to do precisely this, using the following crate: https://github.com/Manishearth/rust-gc.

> Of course, there is an argument that just GCing everything is as efficient as bothering with manual memory management

I specifically said that it should be possible to mix GC with other types of memory management.

The problem is that I often hear from C++ crowd "GC is bad, mmkay!", without mentioning that there are specific cases where you have to use/implement GC.


Where to place a record (struct) in Modula-3:

    VAR
      stackOrGlobalMem: RECORD ... END;

      heapGC : REF RECORD ... END;

      somewhereManual : UNTRACED REF TO RECORD ... END;

      rawMem : ADDRESS;

Also valid for any other data type in the language.

So one can take advantage of GC productivity, while making use of C++ like features for manual allocation when required.

I remember reading a paper with a generics module for using smart references as well.

There are other not so well know GC enabled system programming languages with similar feature sets.

EDIT: like was missing




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

Search: