Do I have to do a delete? Or will .net free it automatically? 
Author Message
 Do I have to do a delete? Or will .net free it automatically?

I have legacy structures which I have put into stdafx etc.

typedef struct
{
    int;
    int;
    char[1024];

Quote:
}A;

I then declare the structure in a managed class

public __gc class MyClass
{
A    *a;

MyClass()
{
    a = new A();

Quote:
}
}

Do I have to explicitely delete a? I just want to be certain.

Thanks



Sat, 17 Sep 2005 17:24:58 GMT  
 Do I have to do a delete? Or will .net free it automatically?

Quote:

> I have legacy structures which I have put into stdafx etc.

> typedef struct
> {
>     int;
>     int;
>     char[1024];
> }A;

> I then declare the structure in a managed class

> public __gc class MyClass
> {
> A    *a;

> MyClass()
> {
>     a = new A();
> }
> }

> Do I have to explicitely delete a? I just want to be certain.

Yes, you do.  GC will automatically reclaim instances of MyClass, but not
unmanaged objects owned by instances of MyClass.

-cd



Sat, 17 Sep 2005 22:56:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Doing something and still having the GUI go

2. free() done correctly?

3. Doing .NET with C++

4. Creating a Virtual directory through a program as done by VS.NET IDE

5. can this be done using C# in .NET?

6. anyone doing professional .net development in nyc?

7. System.Threading.Timer , am I doing this correctly ?

8. Threading problem. I'm doing something wrong

9. How Should I go about doing this?

10. static member inheritance not doing what I want...

11. What is the common methjod of doing this in C#

12. Microsoft shouldn't have done this

 

 
Powered by phpBB® Forum Software