Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: High level C Date: Fri, 05 Aug 2016 08:24:18 -0700 Organization: None to speak of Lines: 24 Message-ID: References: <87mvlimt9i.fsf@bsb.me.uk> <5793c3cb.1636046@news.xs4all.nl> <65b61a13-a54c-4ade-9168-4d71de86103f@googlegroups.com> <89cbb9bc-51c5-45f0-b0ba-c0d469a0b668@googlegroups.com> <20160731164221.2f1d338d@maxa-pc> <20160805054817.0af37f27@maxa-pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="24772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/azTSTcsvsgQNKCqQQt6AF" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:oRkq7hYQiWye1byINd/eL7oPaKY= sha1:zgQpCkU2Mxr0aV/2mMMouvEefKA= Xref: csiph.com comp.lang.c:91733 Melzzzzz writes: > On Thu, 04 Aug 2016 19:17:42 -0700 > Tim Rentsch wrote: >> Something I wanted to mention but didn't work its way into the >> flow is how to deal with resources (eg, open files). Any >> resource that is needed normally will be given its own object. >> When a resource object is allocation, normally it will register >> a "finalization hook", a function that is called just before >> the object is about to be reclaimed. I think most collectors >> these days provide a way to associate finalization hooks with >> allocated objects, for exactly this purpose. > > Wrong. Finalizers are useless for resource management as conservative GC > is non deterministic. Finalizers are only good for debugging purposes... I would imagine that non-deterministic finalization might still be useful. For example, if you have an open file associated with some object, closing that file *eventually* might be good enough. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"