Crash for buffer partially allocated?
Crash for buffer partially allocated?
- Subject: Crash for buffer partially allocated?
- From: Jean-Denis MUYS <email@hidden>
- Date: Mon, 24 Sep 2012 16:46:07 +0000
- Thread-topic: Crash for buffer partially allocated?
Hi,
I have a very strange crash I am not sure how to debug.
This a Flex native extension running on iOS (Yes, I know, don't rub salt in the wound). It crashes with an EXC_BAD_ACCESS when constructing a C++ object. The C++ object is declared, and therefore allocated and constructed, within a dispatch_async block.
The crash is on a line that sets a long member to 0. The allocation returned a pointer that is not NULL. All data members up the one crashing can be read (and written) just fine. The one crashing, and all that follow, are not readable at all. LLDB says "error: read memory from 0x17bf28c failed (0 of 4 bytes read)".
In fact, the C++ object memory stops being readable in a member declared before declared "BYTE bufferOutStream[32*1024];". That block of memory doesn't need to be constructed, but I ask LLDB to print this->bufferOutStream[0], it replies "error: parent failed to evaluate: read memory from 0x17af28c failed (23924 of 32768 bytes read)".
So that buffer is readable up to some point within it, as if the C++ object was only partially allocated.
The offset from the start of the object (this) at which point memory starts to be unreadable by the debugger is 0x017bf294 - 0x0179f000 = 131732 bytes.
The object is allocated using the usual C++ new operator. As I said, the new call returns a non NULL pointer.
Is there some limitation on memory allocation within a dispatch_async block? What can I do to investigate this bug? The problem is made more painful by the lack of debugging tools provided by Adobe for Flex native extensions. Following one of their blog post, I managed to run the resulting Flex App from within Xcode. LLDB shows me symbolically where in the native library I crash. Unfortunately, breakpoints do not break.
I can shuffle code around, for example allocating that object on the main thread, and only using it in the block, but I'd rather have some more evidence-based approach (I'll still try to duffle things around of course).
I am running Xcode 4.5. The compiler is LLVM 4.1. The C++ standard library is "Compiler Default" which I think resolves to libc++.
Many thanks,
Jean-Denis
[Logo Kleegroup]
Klee Group is a great place to work – Il fait bon travailler à Klee Group
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden