Automatic garbage collection in C is possible with libraries like libgc, but with allocppx.pl, you can just preprocess your file into generating heaps, and these heaps can be used for memory allocation. The type of GC is used, mark and sweep + reference counting. Every memory allocation MAY have a trace, and this trace can be used to ‘refget’ and ‘refunget’. Heap items that are NULL or have 0 refs are collected via mark and sweep.

The generated code is very readable, you can just look at it to get a clue. However, this Perl document is annotated with POD so you can view it in man pages etc. I have submitted an ASCII render of the manpage in Gist.

I hope you enjoy this.

  • ChubakPDP11+TakeWithGrainOfSaltOP
    link
    -72 months ago

    Cool, as I just said, Rust is more of a ‘fandom’ than a ‘compiler’ really, it’s also not much of a ‘language’. I use C because it’s standardized by ISO, not some basement-dwelling incels who keep RFCi’ing their ideas instead of implementing it their own.

    • @UlrikHD
      shield
      A
      link
      5
      edit-2
      2 months ago

      Please refrain from using slurs and disparaging people for no good reason on our instance.

      • ChubakPDP11+TakeWithGrainOfSaltOP
        link
        12 months ago

        Alright sorry. I’m just trolling people. If you go to my profile I have a lot of Rust projects. @hascat @FizzyOrange

    • @hascat
      link
      English
      62 months ago

      If C is so great, why do you have to hack in garbage collection?

    • @[email protected]
      link
      fedilink
      English
      5
      edit-2
      2 months ago

      I’d say you’re misinformed, but it requires some real idiocy to be that badly misinformed and that deliberately insulting to a whole programming language community.