• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
file scan results in EX_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file scan results in EX_BAD_ACCESS


  • Subject: file scan results in EX_BAD_ACCESS
  • From: Daniel Child <email@hidden>
  • Date: Fri, 31 Aug 2007 13:38:37 -0400

Hi All,

I am trying to parse a large file without approximately 300,000 lines of text. Judging from the console print, the method does go through all the records, but then the program seems to freeze with a message "Loading 87348 stack frames", and when I hit cancel to that alert, I get the EX_BAD_ACCESS error. Because of the way the debugger freezes (and because it would take years to load 87000 stack frames), I'm having a terrible time tracing the error.

Critical portions of code below. Thanks for the help.

Daniel

(in main)

	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	DataParser *dp = [DataParser parserWithRecordDelim: @"\r"];
	NSString *path, *fullPath, *fileName;
	NSFileManager *NSFm;
	NSMutableArray *theData;

	fileName = @"cleaner data.txt";
	NSFm = [NSFileManager defaultManager];
	path = @"/Users/danielchild/Documents/DATA/";
	fullPath = [path stringByAppendingPathComponent: fileName];

	theData = [dp parseFileAtPath: fullPath];
	[pool release];

	return 0;

The parser is created as follows:

+ (DataParser *) parserWithRecordDelim: (NSString *) rd
{
  DataParser *dp = [[[DataParser alloc] init] autorelease];
  [dp setRecordDelim: rd];
  return dp;
}

And the parse file method is this:

- (NSMutableArray *) parseFileAtPath: (NSString *) path
{
NSString *fileAsString, *oneRecord;
NSMutableArray *unparsedRecords = [[[NSMutableArray alloc] init] autorelease];


  fileAsString = [NSString stringWithContentsOfFile: path];
  NSScanner *scanner = [NSScanner scannerWithString: fileAsString];
  while (![scanner isAtEnd])
  {
    if ([scanner scanUpToString:recordDelim intoString: &oneRecord])
    {
      [unparsedRecords addObject: oneRecord];
      printf("%s\n", [oneRecord cString]);
    }
  }
  return unparsedRecords;
}

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: file scan results in EX_BAD_ACCESS
      • From: Mike Blaguszewski <email@hidden>
    • Re: file scan results in EX_BAD_ACCESS
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: Per Process HTTP Proxy
  • Next by Date: Re: file scan results in EX_BAD_ACCESS
  • Previous by thread: Re: Per Process HTTP Proxy
  • Next by thread: Re: file scan results in EX_BAD_ACCESS
  • Index(es):
    • Date
    • Thread