Link error
Joakim Schramm
joakim at astrocalc.com
Tue May 23 12:11:36 CDT 2006
Hi,
I have run into a some what hard to track and dignose error which also makes
it difficult to give a reproducable example. The thing is that the instance
in code that errors works fine the 3 first times it is executed but then
fail although the conditions basically is the same. Values has changed but
they do exists in dbs in same correct relation as the previous succesful
ones. The code piece as such is a part of a function involved in a larger
repeated pattern so there might be something there causing it and this
request for help is mainly to get some hint of "what" to look for.
The code in question is rather straith forward
Set mLink = mAtlasDB.Link(lnkZoneHasData)
Set ZoneArrSet = mLink.FindLinked(ZoneId, tZones, tZoneData)
Set ZoneSet = ZoneBitSet
Set itr = ZoneSet.MakeNewIterator
On 4th call to this function the "FindLinked" generates an Automation error
-2147418113, this is when a ArraySet is used.
If I change it to use a BitSet instead (using FindLinkedAsBitSet), on 4th
time the program simply "hangs" at this point and eventually crashes.
If I set FindLinked direct to a Vset the object is set to nothing, but if I
set FindLinkedAsBitSet to a Vset the same hang and crash apprears.
I know it has nothing to do with the records as such, they work
independently or if they "happen" to be before the 4th in iteration order.
Worth to mention as well is that this is a part of a search routine.
Initially this routine is called:
Function SearchPlace(ByVal PlaceName As String, CountryID As Long, ByVal
SearchScope As Long, ByVal SearchCriteria As Long) As Long
Dim Col As VBitSet
Dim Res As VBitSet
Dim ResSearch As VSet
Dim FirstRec As Long
Dim cnt As Long
Dim mLink As VLink
Set ItrSearch = Nothing
Set mLink = mAtlasDB.Link(lnkCountryHasPlaces)
If Not CBool(SearchScope) Then
Set Col = mLink.FindLinkedAsBitSet(CountryID, tCountry, tPlaces)
End If
Select Case SearchCriteria
Case 0&
Set Res = fPlace.FindValue(PlaceName, Col)
Case 1
Set Res = fPlace.FindStartsWith(PlaceName, Col)
Case 2
Set Res = fPlace.FindEndsWith(PlaceName, Col)
Case Else
Set Res = fPlace.FindContains(PlaceName, Col)
End Select
If Not Res Is Nothing Then
Set ResSearch = Res
cnt = ResSearch.Count
Set ItrSearch = ResSearch.MakeNewIterator
FirstRec = ItrSearch.FirstItem
uCurrPlace = GetPlaceUDT(FirstRec)
End If
SearchPlace = cnt
End Function
The search results are stored in the global iterator ItrSearch, which then
are stepped though and a value from the record is used to pull a set of
linked records for processing.
It seem to me as it almost is a memory collition or "leak" involved here,
but I can't tell for sure if it's in my code or in Valentina. And again,
it's very hard for me to produce an working example of this, I need some
"hints" and maybe the automation error number can give some lead?
Regards,
Joakim
More information about the Valentina
mailing list