RFC on range design for D2

Leandro Lucarella llucax at gmail.com
Tue Sep 9 08:06:39 PDT 2008


superdan, el  9 de septiembre a las 10:12 me escribiste:
> > For how
> > long you will have the memory "alive", it will use "regular" GC semantics
> > (i.e., when nobody points at it anymore)? In that case, leting the
> > programmer leave dangling pointers to data that should be "dead" without
> > crashing, wouldn't make easier to introduce memory leaks?
> 
> such is the peril of gc. clearly meshing scoping with gc ain't gonna be perfect. but i like the next best thing. scarce resources are deallocated quick. memory stays around for longer. no dangling pointers.

I was talking about logical[1] memory leaks, wich are possible even with
GC.

int[] a;
if (condition) {
   Array!(int) b;
      a = b.all;
}

If you expect that b memory is freed at the end of the scope, and
a retains it, is a logical memory leak (you probably forgot to null
a before the scope ended). I think this kind of errors should be detected
as soon as possible, as opposed to let a keep using that memory (or leak
it).

[1] http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Benefits

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Desde chiquito quería ser doctor
Pero después me enfermé y me hice músico


More information about the Digitalmars-d-announce mailing list