On Monday, 21 September 2015 at 09:58:31 UTC, Chris wrote:
I sometimes wonder - and please forgive me my ignorance, because I'm not a GC expert at all - if it would be possible to create a system where the created objects know their own life spans and destroy themselves, once they are no longer used. Like the cells in our bodies.

Yes, this is the system Rust uses, but the compiler has to prove the life spans at compile time. So how convenient that is, is limited to the capabilities of the prover and for how long you want to wait for the computation of the life times.

In essence you have to choose between a simple tracking system that is a bit annoying and solving NP-complete problems (which may work out fine in many cases, but not in all possible configurations).

There are many ways to improve on this based on what tradeoffs you accept. Like you could segment the heap and prove that at a given point all the objects in the heap have to be dead, and just accept that you waste some memory up until that point.

Etc.

        • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
          • Re: Go 1.... Ola Fosheim Grøstad via Digitalmars-d-announce
            • Re: ... Daniel Kozak via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Daniel Kozak via Digitalmars-d-announce
        • Re: Go 1.5 Robert M. Münch via Digitalmars-d-announce
    • Re: Go 1.5 Rory McGuire via Digitalmars-d-announce
    • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
  • Re: Go 1.5 Chris via Digitalmars-d-announce
    • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
      • Re: Go 1.5 Chris via Digitalmars-d-announce
        • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
        • Re: Go 1.5 ZombineDev via Digitalmars-d-announce
          • Re: Go 1.... Ola Fosheim Grøstad via Digitalmars-d-announce
            • Re: ... Chris via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
          • Re: Go 1.... jmh530 via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... jmh530 via Digitalmars-d-announce
              • ... Ola Fosheim Grostad via Digitalmars-d-announce

Reply via email to