dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Refcounting mechanism


From: Gnanavel S
Subject: [DotGNU]Refcounting mechanism
Date: Tue, 22 Jul 2003 19:47:44 +0530

Hi All,
I have tried the following code under the PNet,
I have complied it using cscc and run via the ilrun,
It never seems to call the destructor (~FinalizerObj)
Let me know if some thing else had to be done?

using System;
class FinalizerObj {

int n;

public FinalizerObj( int n ) {

this.n = n;

Console.WriteLine("Created Finalizer object {0}", n);

}


~FinalizerObj() {

Console.WriteLine("Finalizing finalizer object {0}", n);

}

}


class FinalizerContainingObj {

FinalizerObj subObj1;

int n;

FinalizerObj subObj2;


public FinalizerContainingObj( int n ) {

this.n = n;

subObj1 = new FinalizerObj(n * 100);

subObj2 = new FinalizerObj((n * 100) + 1);

Console.WriteLine("Creating containing object {0}", n);

}


~FinalizerContainingObj( ) {

Console.WriteLine("Finalizing finalizer containing obj {0}", n);

}

}


class TestApp {

static void Main() {

for( int i = 0; i < 5; ++i ) LeakAnObj(i);

}


static void LeakAnObj(int i) {

FinalizerContainingObj obj = new FinalizerContainingObj(i);

}

}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]