manual memory management

ixid nuaccount at gmail.com
Tue Jan 8 06:43:04 PST 2013


On Monday, 7 January 2013 at 17:19:25 UTC, Jonathan M Davis wrote:
> On Monday, January 07, 2013 17:55:35 Rob T wrote:
>> On Monday, 7 January 2013 at 16:12:22 UTC, mist wrote:
>> > How is D manual memory management any worse than plain C one?
>> > Plenty of language features depend on GC but stuff that is 
>> > left
>> > can hardly be named "a lousy excuse". It lacks some 
>> > convenience
>> > and guidelines based on practical experience but it is 
>> > already
>> > as capable as some of wide-spread solutions for systems
>> > programming (C). In fact I'd be much more afraid of runtime
>> > issues when doing system stuff than GC ones.
>> 
>> I think the point being made was that built in language 
>> features
>> should not be dependent on the need for a GC because it means
>> that you cannot fully use the language without a GC present and
>> active. We can perhaps excuse the std library, but certainly 
>> not
>> the language itself, because the claim is made that D's GC is
>> fully optional.
>
> I don't think that any of the documentation or D's developers 
> have ever
> claimed that you could use the full language without the GC. 
> Quite the
> opposite in fact. There are a number of language features that 
> require the GC
> - including AAs, array concatenation, and closures. You _can_ 
> program in D
> without the GC, but you lose features, and there's no way 
> around that. It may
> be the case that some features currently require the GC when 
> they shouldn't,
> but there are definitely features that _must_ have the GC and 
> _cannot_ be
> implemented otherwise (e.g. array concatenation and closures). 
> So, if you want
> to ditch the GC completely, it comes at a cost, and AFAIK no 
> one around here
> is saying otherwise. You _can_ do it though if you really want 
> to.
>
> In general however, the best approach if you want to minimize 
> GC involvement
> is to generally use manual memory management and minimize your 
> usage of
> features that require the GC rather than try and get rid of it 
> entirely,
> because going the extra mile to remove its use completely 
> generally just isn't
> worth it. Kith-Sa posted some good advice on this just the 
> other day, and he's
> written a game engine in D:
>
> http://forum.dlang.org/post/vbsajlgotanuhmmpnspf@forum.dlang.org
>
> - Jonathan M Davis

Just speaking as a bystander but I believe it is becoming 
apparent that a good guide to using D without the GC is required. 
We have a growing number of users who could be useful converts 
doing things like using it as a game engine, giving some general 
help with approaches and warnings about what does and doesn't 
require the GC would greatly smooth the process. Sadly I lack the 
talent to write such a guide.


More information about the Digitalmars-d mailing list