Re: releaseing unmanaged STL objects
From: MuZZy (leyandrew_at_yahoo.com)
Date: 02/17/05
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: Authenticate agains several Active Directory Domains"
- Previous message: Newbie: "Re: Hyperlink in DataGrid"
- In reply to: Willy Denoyette [MVP]: "Re: releaseing unmanaged STL objects"
- Next in thread: Willy Denoyette [MVP]: "Re: releaseing unmanaged STL objects"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Feb 2005 09:44:36 -0500
Willy Denoyette [MVP] wrote:
> "MuZZy" <leyandrew@yahoo.com> wrote in message
> news:3tKdnYkVUbQsZI7fRVn-ig@comcast.com...
>
>>Sorry, man :) I assumed that if the NG is about managed code (C#), then we
>>would be talking about managed C++ as well... My fault.
>>
>
>
> *** No problem.
>
>
>>>Yes, you destroy the STRPAIRVECTOR, STRSET etc objects ( whatever they
>>>are) like it should, but I would prefer you do this deterministically
>>>(implementing IDisposable).
>>
>>Again I can only agree! But again, it's not possible in my case...
>>
>
> *** There is no problem with this, as long as the size of these unmanaged
> memory structures aren't too large there is no need to implement
> IDisposable.
>
Those memory structures contain just some tables names and are mo big in size.
Also, most of them get finalized right after i call GC.WaitForPendingFinalizers().
>
>>>However I don't like what is following, what is Numbers and Num, where
>>>are the coming from, are they members of this class?
>>
>>"Numbers" is the static ArrayList object of this class, and "Num" is this
>>class's object's int variable.
>
> I don't know how large this ArrayList can be and how many of such AL you are
> creating, but keep in mind that a static's lifetime is tied to it's
> containing application domain, and that an ArrayList never shrinks. Assume
> your AL holds 100000 object (boxed int's in your case) it will take 1.2MB of
> managed memory that will stay in memory until the AD unloads.
Thanks for your comment on this!
First, it's added only for debugging purpose - this static ArrayList as well as Num will not be
present in customer build. But anyway, we are experiencing memory losses of dozens of megabytes, so
one more MB wouldn't change the whole picture.
Andrey
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: Authenticate agains several Active Directory Domains"
- Previous message: Newbie: "Re: Hyperlink in DataGrid"
- In reply to: Willy Denoyette [MVP]: "Re: releaseing unmanaged STL objects"
- Next in thread: Willy Denoyette [MVP]: "Re: releaseing unmanaged STL objects"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|