Because the memory of the deallocated object is possibly now occupied by another object of different type, the last line in the crash stack might be mis-leading because it's not really part of your programmed execution path, so usually we need to look up the trace a little bit. This is an old question but the EXC_BAD_ACCESS KERN_INVALID_ADDRESS crash is not due to memory leak, but due to the attempt to access an deallocated object. Char* p /* = garbage */ *p = 4 could do it.) – Apr 9 at 15:20. It could also imply an uninitialized pointer. EXC_BAD_ACCESS implies a dangling pointer, not the former. A dangling pointer occurs when a pointer references memory that has been deallocated. A memory leak occurs when memory is still allocated but nothing references it (or nothing references it usefully). This answer is incorrect and A 'memory leak' is the opposite of a 'dangling pointer', and what you have here results from a dangling pointer. MyApp works good in 98% of the time, But sometimes it shows a crash.
0 Comments
Leave a Reply. |