[VNET 0004270]: Memoryleak in FindRange

Ruslan Zasukhin sunshine at public.kherson.ua
Sun May 24 05:03:36 CDT 2009


On 5/24/09 12:40 PM, "Ivan Smahin" <ivan_smahin at paradigmasoft.com> wrote:

>>> I just tried the 4.2b7, but the memoryleak-bug is still in.
>>> Please guys, I'm somehow stucked without this fix... ;-)
> 
>> Actually b7 should contains fix
> 
>> Ivan?
> 
>> May be more leaks present ??
> 
> 
> It is copied from http://www.valentina-db.com/bt/view.php?id=4270
> (28.04.2009)
> 
> 1. There is unmanaged resource under IVBitSet object.
> So it should be freed (explicitly calling IVBitSet::Dispose() method) by you.
> 
> It should be something like:
> 
> resultSet = fldCat.FindRange(False, 0, e.max_cat, True)
> ... do something with resultSet ...
> resultSet.Dispose()
> 
> 2. vSet::Dispose() contained a bug. It is fixed now.

In other words

You cannot just assign in loop into the same variable and be in hope hat
Garbage Collecto will self kill object right now.

WRONG EXAMPLE:

    loop
    {
        resultSet = FindRange()
    } 


RIGHT EXAMPLE:
    
    loop
    {
        resultSet = FindRange()
        ....    
        resultSet.Dispose()    << you ask kill object right now.
    } 

RIGHT EXAMPLE2:

    loop
    {
        using( resultSet = FindRange() )
        {
            ....   
        }  <<  resultSet will die here
    } 





-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list