Hi,
I've been trying to use RegexKitLite to do some screen scraping for an iPhone app. I've been trying to make sure memory is
being reclaimed properly at this point in m app development. Unfortunately, my app now crashes in a very reproducible way
with the following stack trace:
Full Plate[1117:13c13] *** -[CFString release]: message sent to deallocated instance 0x7bee0a80
#0 0x018ace1e in ___forwarding___ ()
#1 0x018acce2 in __forwarding_prep_0___ ()
#2 0x01852435 in CFRelease ()
#3 0x000fbbee in rkl_clearCachedRegexSetTo (cachedRegex=0x1375cc) at /Volumes/STORAGE/Documents/FullPlate/Classes/Sources/RegexKitLite.m:1696
#4 0x00103978 in rkl_getCachedRegexSetToString (regexString=0x132b0c, options=32, matchString=0x7e8128f0, matchLengthPtr=0xb010269c, matchRange=0xb0102820, error=0xb0102b60, exception=0xb01026a8, status=0xb01026a4) at /Volumes/STORAGE/Documents/FullPlate/Classes/Sources/RegexKitLite.m:1002
#5 0x000f9d92 in rkl_performRegexOp (self=0x7e8128f0, _cmd=0x12061a, regexOp=37, regexString=0x132b0c, options=32, capture=0, matchString=0x7e8128f0, matchRange=0xb0102820, replacementString=0x0, error=0xb0102b60, result=0x0, captureKeysCount=0, captureKeys=0x0, captureKeyIndexes=0x0) at /Volumes/STORAGE/Documents/FullPlate/Classes/Sources/RegexKitLite.m:1119
#6 0x000fcfd2 in -[NSString(RegexKitLiteAdditions) arrayOfCaptureComponentsMatchedByRegex:options:range:error:] (self=0x7e8128f0, _cmd=0x12061a, regex=0x132b0c, options=32, range={location = 0, length = 193038}, error=0xb0102b60) at /Volumes/STORAGE/Documents/FullPlate/Classes/Sources/RegexKitLite.m:2437
#7 0x000e563a in -[AllRecipesManager loadRecipe:withReferer:] (self=0x7bec08b0, _cmd=0x120446, url=0x7cadcb70, referer=0x7cc99ef0) at /Volumes/STORAGE/Documents/FullPlate/Classes/Sources/AllRecipesManager.m:648
#8 0x000e30f4 in -[AllRecipesManager generateRecipes:] (self=0x7bec08b0, _cmd=0x12085e, menuViewController=0x7cc3d100) at /Volumes/STORAGE/Documents/FullPlate/Classes/Sources/AllRecipesManager.m:248
#9 0x003bd4e6 in -[NSThread main] ()
#10 0x003bd457 in __NSThread__main__ ()
#11 0x93f4bed9 in _pthread_start ()
#12 0x93f4f6de in thread_start ()
When I look at the method at the top of the stack, the list of local variables says that cachedRegex->setToString is a freed object. This code is being executed in a thread. The first time I run this thread, I don't see this problem. The second time I run this thread, I invariably get this crash. Strangely, I call
arrayOfCaptureComponentsMatchedByRegex: options: range: error:
twice during the thread code before this crash occurs.
Each of the three calls to
arrayOfCaptureComponentsMatchedByRegex: options: range: error:
(the two that work and the one that causes the crash) all involve different regular expressions.