:: Re: [Dng] garbage collection
Pàgina inicial
Delete this message
Reply to this message
Autor: Jude Nelson
Data:  
A: Hendrik Boom
CC: dng
Assumpte: Re: [Dng] garbage collection
Hi Hendrick,

> There are times when garbage collection is appropriate, and times when

it is not.

> Most of the time it doesn't hurt, and is a great help for ensuring

correctness.

I totally agree! I was just being snarky about .NET leaking memory despite
garbage-collecting (but clearly there are cases where it can happen where
there's nothing the CLR can do about it, such as when the leak occurs in an
external library).

> Use of explicitly managed memory is considered unsafe, and is allowed

in modules explicitly declared UNSAFE. The language's safety
guarantees do not apply in that case, and the programmer assumes
responsibility for any unsafe module's behaviour.

> I think that's the right approach. It simply isn't an all-or-nothing

matter.

I agree. I wish this were a more common feature in GC languages.

-Jude

On Sat, Dec 20, 2014 at 8:55 AM, Hendrik Boom <hendrik@???>
wrote:
>
> On Sat, Dec 20, 2014 at 02:45:30AM -0500, Jude Nelson wrote:
> >
> > I'm not really a fan of garbage collection for system-level code (I just
> > use valgrind instead to catch leaks early and often), but can .NET
> actually
> > leak memory? What's the point of it having a garbage collector then?
> Heh,
> > good thing the CLI got open-sourced--at least we can fix it if so!
>
> There are times when garbage collection is appropriate, and times when
> it is not.
>
> Most of the time it doesn't hurt, and is a great help for ensuring
> correctness.
>
> Some of the time, such as the system-level code you mention, it's the
> wrong tool.
>
> That's why Modula 3 has both garbage-collected and explicitly managed
> memory.
>
> Use of explicitly managed memory is considered unsafe, and is allowed
> in modules explicitly declared UNSAFE. The language's safety
> guarantees do not apply in that case, and the programmer assumes
> responsibility for any unsafe module's behaviour.
>
> I think that's the right approach. It simply isn't an all-or-nothing
> matter.
>
> -- hendrik
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>