[VNET 0004270]: Memoryleak in FindRange
Thomas Flemming
tf at ttqv.com
Sun May 24 05:21:02 CDT 2009
ok, I understand now.
my problem were these conecting FindRanges:
resultSet = fldCat.FindRange(False, 0, e.max_cat, True)
resultSet = fldSize.FindRange(True, e.min_size, 9999999, False, resultSet)
...
resultSet.dispose
is actually wrong. Should be:
resultSet1 = fldCat.FindRange(False, 0, e.max_cat, True)
resultSet2 = fldSize.FindRange(True, e.min_size, 9999999, False, resultSet1)
...
resultSet1.dispose
resultSet2.dispose
Like this it works now, now Memory-leak.
Thanks quys :-)
Tom
Ivan Smahin schrieb:
> Hello Thomas,
>
> Sunday, May 24, 2009, 12:48:27 PM, you wrote:
>
>> Hi,
>
>> I'm using Dispose now:
>
>> resultSet = fldCat.FindRange(False, 0, e.max_cat, True)
>> If resultSet IsNot Nothing Then
>> resultSet = fldSize.FindRange(True, e.min_size, 9999999, False, resultSet)
>> End If
>
> resultSet points to some unmanaged recourse here.
>
>> If resultSet IsNot Nothing Then
>> resultSet = fldEN.FindRange(False, e.south, 90 * di, False, resultSet)
>> End If
>
> Here is ANOTHER resultSet object which points to another unmanaged
> recourse.
>
>
>> If resultSet IsNot Nothing Then
>> resultSet = fldES.FindRange(False, -90 * di, e.north, False, resultSet)
>> End If
>> If resultSet IsNot Nothing Then
>> resultSet = fldEW.FindRange(False, -180 * di, e.east, False, resultSet)
>> End If
>> If resultSet IsNot Nothing Then
>> resultSet = fldEE.FindRange(False, e.west, 180 * di, False, resultSet)
>> End If
>> If resultSet IsNot Nothing Then
>> c = CType(resultSet, IVSet).Count
>> ctotal += c
>> 'resultIter = CType(resultSet, IVSet).MakeNewIterator
>> 'mTblObjects.RecID = resultIter.FirstItem
>> 'mTblObjectsData.RecID = resultIter.FirstItem
>
>> resultSet.Dispose()
>
>> End If
>
> So where do you call 'dispose' for all that objects?
> I see only one call for last object.
>
>
>
>> Ivan Smahin schrieb:
>>> Hello Ruslan,
>>>
>>> Sunday, May 24, 2009, 12:33:34 PM, you wrote:
>>>
>>>> On 5/24/09 12:31 PM, "Thomas Flemming" <tf at ttqv.com> wrote:
>>>> Hi Thomas,
>>>>> 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.
>>>
>>>
>>>
>
>
>
>
--
/****************************************
** Dipl.-Ing. Thomas Flemming
** Software Development
**
** Touratech AG
** Auf dem Zimmermann 7-9
** D-78078 Niedereschach
**
** mail tf at ttqv.com
** fon +49 (0) 7728 9279-206
** fax +49 (0) 7728 9279-29
**
** http://www.ttqv.com
** http://www.touratech.de
**
** ... und immer dem Pfeil nach!
***************************************/
More information about the Valentina
mailing list