D Language 2.0

Leandro Lucarella llucax at gmail.com
Thu Jan 21 05:26:41 PST 2010


Andrei Alexandrescu, el 20 de enero a las 20:48 me escribiste:
> BCS wrote:
> >Hello Andrei,
> >
> >>BCS wrote:
> >>
> >>>Also there is one thing that -nogc would have over what you are
> >>>talking about; you could use it on some modules and not others. If I
> >>>have some performance critical code where attempting to use the GC
> >>>would break it's perf contract, I can put it in it's own module and
> >>>compile just it with -nogc and then link it in with code that does
> >>>use the GC.
> >>>
> >>Meh. This has been discussed in the C++ standardization committee, and
> >>it gets really tricky real fast when you e.g. use together several
> >>libraries, each with its own view of memory management. My impression:
> >>don't.
> >
> >
> >Why would having one chunk of code get checked for calls to the GC
> >and another not be any more complicated than mixing
> >malloc/free+add/removeRoot with normal GC? I'm beginning to wonder
> >if I'm calling for something different than other people are.
> >
> >What I'm thinking of would have zero effect on the generated code,
> >the only effect it would have is to cause an error when some code
> >would normally attempt to invoke the GC.
> 
> It's much more complicated than that. What if a library returns an
> object or an array to another library?

The same that happens in C now, memory management is part of the interface
and you should state if the returned object's memory is managed by the
library or the user.

This introduces a problem D doesn't have now, but let's keep the focus
here, this will be used mostly only in embedded environments, where this
problem is already present, so it's not too bad. People using "regular"
D probably won't be using any "embedded library". They other way arround
could be a little more likely, and since "embedded guys" are tought, they
should be able to cope with this issue (or avoid using "regular"
D libraries that use the GC).

> Memory allocation strategy is a cross-cutting concern.

Yes.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
HACIA NEUQUEN: EL JUEVES SALDRA CARAVANA CON PERROS
DESDE CAPITAL EN APOYO AL CACHORRO CONDENADO A MUERTE
	-- Crónica TV



More information about the Digitalmars-d mailing list