:: [Dng] garbage collection
トップ ページ
このメッセージを削除
このメッセージに返信
著者: Hendrik Boom
日付:  
To: dng
古いトピック: Re: [Dng] Study
題目: [Dng] garbage collection
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