Re: Weird problem with array declaration in action
Re: Weird problem with array declaration in action
- Subject: Re: Weird problem with array declaration in action
- From: David Hinz <email@hidden>
- Date: Mon, 10 Feb 2003 15:43:22 -0700
The problem is that it isn't the image that is being stored in the
two-dimensional array. It is some other information about each pixel
that is being stored in the array. I used the suggestion of using the
setrlimit and raising the current stack size up to the hard limit, and
that worked.
I'll take a look at NSBitmapImageRep to see if that might help in anyway.
Thanks,
david.
John C. Randolph wrote:
I think you'd be better off keeping this in an NSBitmapImageRep,
instead of a two-dimensional array on the stack.
-jcr
On Saturday, February 8, 2003, at 09:22 PM, David Hinz wrote:
That could be the problem. In another app I have the same type of
two-dimensional array, but it is actually an instance variable.
If this is the problem, is there a way to increase the amount of
memory a thread can have on the stack?
thanks,
david.
On Saturday, February 8, 2003, at 09:47 PM, Chris Ryland wrote:
On Saturday, February 8, 2003, at 11:09 PM, David Hinz wrote:
In a new app that I'm writing it is crashing because of what looks
like
some type of inconsistency between my source code and the NIB file.
The dump is:
Thread 0 Crashed:
#0 0x00004388 in -[NewAppController start:]
(NewAppController.m:16)
#1 0x930f90e4 in -[NSApplication sendAction:to:from:]
#2 0x93119868 in -[NSControl sendAction:to:]
#3 0x9315dfac in -[NSCell _sendActionFrom:]
#4 0x930f2ad4 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
#5 0x9315dbcc in -[NSButtonCell
trackMouse:inRect:ofView:untilMouseUp:]
#6 0x9312d504 in -[NSControl mouseDown:]
#7 0x930c0888 in -[NSWindow sendEvent:]
#8 0x930a8788 in -[NSApplication sendEvent:]
#9 0x930b1608 in -[NSApplication run]
#10 0x9315f6b8 in NSApplicationMain
#11 0x00004160 in main (main.m:13)
#12 0x00003ee4 in _start (crt.c:267)
#13 0x00003d64 in start
The strange thing is if I comment out or change a single line of code
in the (IBAction)start:(id)sender method then the application works.
The line is
int pixels[400][400];
It is used to store the state of pixels that will eventually be in an
NSView. (The subclass of the NSView doesn't even exist yet, and the
array isn't used anywhere else in the code at this point either.)
Also if I change the line to be:
int pixels[400][300];
the the code works also. At this point I can comment out everything
else (about 40 lines of code) from the start: method and the program
still dumps. That is why I think the problem is some type of
inconsistency between the NIB and the code. I've tried selecting the
class in IB and re-reading the .h file. That hasn't helped.
Any ideas? :) I've been fighting this problem for several hours and
have run out of ideas.
Forgive me for suggesting something so simple, but isn't this just
because your per-thread stack storage can't hold 400 x 400 x 4 bytes
(640K, roughly) for this stack local?
Cheers!
--Chris Ryland / Em Software, Inc. / www.emsoftware.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.