Re: releaseing unmanaged STL objects

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: MuZZy (leyandrew_at_yahoo.com)
Date: 02/17/05


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



Relevant Pages

  • Re: router heaps.
    ... The Check Heaps process is run once a minute to verify the consistency ... Basically to verify all the memory structures are ...
    (comp.dcom.sys.cisco)
  • Re: SP 2 compatibility problem
    ... 'Jupiter Jones [MVP Wrote: ... they do not guarantee memory is perfect. ... > shouldn't be any driver conflicts...since you can't install them ... > I was hoping that someone could explain to me, how SP2 can have ...
    (microsoft.public.windowsxp.general)
  • Re: CFont memory leak !?
    ... virtual memory used about 380MB ... Depending on how the font is specified, your font could take more space, but you seem to ... bool ExStatic::SetNewFont(int nPointSize, LPCTSTR lpszFaceName, CDC* ... on my MVP Tips site. ...
    (microsoft.public.vc.mfc)
  • Re: 64bit OS cant do Internet Fax
    ... using a 64bit OS is to take advantage of memory over 4GB, ... If there are not going to be 64bit applications coming - why do we have the ... What is a Microsoft MVP? ... Microsoft Office error message. ...
    (microsoft.public.office.misc)
  • Re: CFont memory leak !?
    ... memory increase until 390MB!!!!!! ... Depending on how the font is specified, your font could take more space, but you seem to ... bool ExStatic::SetNewFont(int nPointSize, LPCTSTR lpszFaceName, CDC* ... on my MVP Tips site. ...
    (microsoft.public.vc.mfc)