DConf 2013 Day 3 Talk 1: Metaprogramming in the Real World by Don Clugston

Leandro Lucarella luca at llucax.com.ar
Fri Jun 14 06:37:17 PDT 2013


Dicebot, el 14 de June a las 09:46 me escribiste:
> Have finally watched it. Great talk and good jokes! :)
> 
> One topic I'd like to hear more about is memory management
> techniques. It was told that only very small amount of garbage is
> generated and managed by GC, most code avoids heap allocations at
> all. Is this somehow enforced (tooling, code review, etc.) or simply
> judged by a common sense?

I would say is enforced by reality. If we have a "leak" we find out
sooner than later. Of course, having that experience people is extra
careful when coding now about those issues. We are starting to implement
code review as the team gets bigger, which also help to detect these
problems earlier.

> Is keeping such restriction easier in D1 than in D2?

Yes, but is because of Tango, not D1. Almost every function that needs
to allocate takes an optional buffer to work on (and for the ones that
didn't we wrote replacements that used this scheme). That makes the
programmer automatically aware of this buffer reusing. I think, same as
Manu said, if/when we were to move to D2 we'll have to completely avoid
phobos unless a similar approach is taken in terms of memory allocation.

We even sometimes reuse exceptions to avoid allocating when something
throws.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Todos en el mundo somos grasas, no hago distinción de sexo y raza, sólo
que algunos lo disfrutan y otros no pueden evitarlo.


More information about the Digitalmars-d-announce mailing list