Untitled
Untitled
I have a program that launches a thread which includes the following (dumbed down) code:
unfortunately this causes a crash with the following text in the console:
*** NSAllocateMemoryPages(-24631) failed
*** Uncaught exception: <NSInvalidArgumentException> *** NSAllocateMemoryPages(-24631) failed
I have already learned (and implemented) that you need a new autorelease pool in the thread and I assume something similar to this needs to be done to fix this problem. If I place this code in the main application thread, it works fine. Any suggestions?
Code:
unichar *buffer;
buffer = NSAllocateMemoryPages(50 * sizeof(unichar));
NSDeallocateMemoryPages(buffer, 50);
*** NSAllocateMemoryPages(-24631) failed
*** Uncaught exception: <NSInvalidArgumentException> *** NSAllocateMemoryPages(-24631) failed
I have already learned (and implemented) that you need a new autorelease pool in the thread and I assume something similar to this needs to be done to fix this problem. If I place this code in the main application thread, it works fine. Any suggestions?