Re: R: Running out of VM
Re: R: Running out of VM
- Subject: Re: R: Running out of VM
- From: Phill Kelley <email@hidden>
- Date: Fri, 23 Dec 2005 15:25:20 +1100
At 12:31 +0100 22/12/05, Germinara, Franco wrote:
>
Hello, why you don't try to use the exceptions manager functions instead
>
of try to check the nil value on return code ?
I am actually trying to understand why nil is not being returned when an
object can't be allocated.
As it happens, I did try using NS_DURING/NS_HANDLER but it does not appear
to catch this problem. I know that the exception mechanism is working
because I inserted an attempt to index beyond the end of a string and it
caught that exception quite happily. However, running out of VM just splats.
At 11:44 -0800 22/12/05, Will Mason wrote:
>
Although his description didn't include the word crash, if you actually
>
try what he's describing, you'll see that he's telling the truth. It
>
crashes. Therefore, there's no time to worry about writing anything to the
>
console or exiting gracefully. However, if you are out of memory it's
>
difficult to see what the difference is between a crash and a rapid
>
controlled exit. The result for the user will be the same.
I've just realized something else. The callback trace from the crash log is:
_objc_trap
_objc_error
__objc_error
_internal_class_createInstanceFromZone
NSAllocateObject
+[NSData dataWithBytes:length:]
When I repeat the test with my own nonsense object, the only thing that
changes is the last line.
In other words, both NSData and my own nonsense object are using
NSAllocateObject.
The documentation for NSAllocateObject says "Returns nil on failure".
I would have thought that running out of VM constituted a "failure".
Cheers, PK
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden