[Mono-list] Minor bug

Michal Moskal malekith@pld-linux.org
Sun, 27 Apr 2003 13:17:57 +0200


On Sun, Apr 27, 2003 at 08:06:39AM +0000, Pablo Baena wrote:
> On Sun, 2003-04-27 at 11:05, Michal Moskal wrote:
> 
> > On Sun, Apr 27, 2003 at 07:52:22AM +0000, Pablo Baena wrote:
> > > On Sat, 2003-04-26 at 23:55, Michal Moskal wrote:
> > > 
> > > > Sure. That's what's GC for ;-) Beside scope of 'a' (which is pointer to
> > > > Clazz in C's sense) is this block only, actual Clazz instance is on
> > > > heap.
> > > 
> > > 
> > > And what is the case with structs that lay on the stack?
> > 
> > Structs are boxed on heap when passed as references, and copied
> > otherwise.
> 
> But how is it that they aren't destroyed when there're references to it?

You cannot have reference to object stored on stack in C# (well... in
fact you can but you can only pass it up function call stack, not to
store it anywhere nor return). So you can have references only to objects
stored on heap, which are garbage collected.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h