Skip navigation.
 
mlRe: NSSpellChecker crashes after 64k words
FROM : The Karl Adam
DATE : Tue Apr 12 17:07:34 2005

If what your saying is true than basically any app with 64K
auto-released objects should crash and that seems like a much more
heinous oversight than NSSpellChecker having a 64K word limit.

Have you tried this with code that just creates auto-released objects?

-Karl

On Apr 12, 2005 6:07 AM, Louis C. Sacha <<email_removed>> wrote:
> Hello...
>
> I don't think your problem is specifically related to NSSpellchecker,
> it's probably just that too many autoreleased objects are being
> created within your loop.
>
> The following example code crashes after a number of iterations
> similar to what you indicated (note that the word "mage" is
> apparently not a real word in American English, but it doesn't really
> make any difference whether the word is misspelled or not):
>
>        NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
>        NSString *testString = @"mage";
>        NSRange found;
>
>        unsigned i, j;
>        for (i=0; i<100; i++)
>        {
>                for (j=0; j<1024; j++)
>                {
>                        found = [checker
> checkSpellingOfString:testString startingAt:0];
>                }
>
>                NSLog(@"count %i",(i*1024 + j));
>        }
>
> If you add a couple lines to create and destroy a temporary
> autorelease pool within the loop doing all of the work, it should fix
> the problem. My choice to use 1024 iterations per pool was arbitrary,
> and you'd probably want to experiment a bit to figure out how often
> to do it to keep your app's memory footprint in check.
>
>        NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
>        NSString *testString = @"mage";
>        NSRange found;
>
>        unsigned i, j;
>        for (i=0; i<100; i++)
>        {
>                NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>
>                for (j=0; j<1024; j++)
>                {
>                        found = [checker
> checkSpellingOfString:testString startingAt:0];
>                }
>
>                NSLog(@"count %i",(i*1024 + j));
>                [pool release];
>        }
>
> Hope that helps,
>
>        Louis
>
>
> >Hi
> >
> >I have written a little program to solve a word puzzle.  The program
> >puts together possible words by appending permutations of supplied
> >letters and syllables.
> >To determine whether the resulting string is a valid word I and
> >using NSSpellChecker
> >
> >                              NSRange wordRange = [spellChecker
> >checkSpellingOfString: string startingAt: 0];
> >                              if (wordRange.length == 0) {
> >                                      NSlog([NSString
> >stringWithFormat: @" %@ is a word", string]);
> >                              }
> >
> >The problem is my program fails with
> >      Executable "MyApp" has exited due to signal 10 (SIGBUS).
> >
> >after checking about 64,000 words.  I guess it's hitting 64k
> >(65,536) and this is some magic limit in NSSpellChecker.
> >
> >Does anybody know how to reset whatever counter is causing
> >NSSpellChecker to give up?
> >I thought at first it was accumulating a large ignored words list,
> >so I added closeSpellDocumentWithTag but that didn't help, and I see
> >that the ignored word list count is zero so that's not it.
> >
> >Denis
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/karl.<email_removed>
>
> This email sent to karl.<email_removed>
>

Related mailsAuthorDate
mlNSSpellChecker crashes after 64k words Denis Stanton Apr 11, 02:35
mlRe: NSSpellChecker crashes after 64k words Dan Saul Apr 11, 18:22
mlRe: NSSpellChecker crashes after 64k words Denis Stanton Apr 12, 10:47
mlRe: NSSpellChecker crashes after 64k words Louis C. Sacha Apr 12, 12:07
mlRe: NSSpellChecker crashes after 64k words The Karl Adam Apr 12, 17:07
mlRe: NSSpellChecker crashes after 64k words Evan DiBiase Apr 12, 17:41
mlRe: NSSpellChecker crashes after 64k words Louis C. Sacha Apr 13, 01:02
mlRe: NSSpellChecker crashes after 64k words Hamish Allan Apr 13, 02:23
mlRe: NSSpellChecker crashes after 64k words Denis Stanton Apr 13, 06:20
mlRe: NSSpellChecker crashes after 64k words Denis Stanton Apr 13, 22:38