Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Memory corruption question on iOS



Permlink Replies: 1 - Last Post: Jun 2, 2017 11:20 PM Last Post By: Janez Atmapuri ... Threads: [ Previous | Next ]
Janez Atmapuri ...

Posts: 58
Registered: 8/19/01
Memory corruption question on iOS
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 1, 2017 5:00 AM
Hi,

Occasionally I get to see:

First chance exception at $0000000186FD9014. Exception class 6. Process
MyApp (884)
MyApp(884,0x16e2ff000) malloc: *** error for object 0x132aaa400:
incorrect checksum for freed object - object was probably modified
after being freed. Process MyApp (884)
*** set a breakpoint in malloc_error_break to debug Process MyApp (884)

The stack trace always shows something different. Not completely
different, but some typical locations, which dont make sense. (no bug
there). Final steps of the stack trace are like this:

:0000000186FD9014 __pthread_kill
:00000001870A3334 pthread_kill
:0000000186F4D9C4 abort
:0000000187019828 szone_error
:000000018701A528 free_list_checksum_botch
:000000018701A4F4 small_free_list_remove_ptr_no_clear
:00000001870106F0 small_malloc_from_free_list
:000000018700DFBC szone_malloc_should_clear
:000000018700D664 malloc_zone_malloc
:000000018701056C malloc
System.SysGetMem(NativeInt)(2064)
System._ReallocMem(void*&, NativeInt)(0x000000016e2fe4e0,2064)
System.DynArraySetLength(void*&, void*, NativeInt,
NativeInt*)(0x000000016e2fe758,0x00000001020d4c8e,1,0x000000016e2fe5a0)
System._DynArraySetLength(void*&, void*,
NativeInt)(0x000000016e2fe758,0x00000001020d4c80,1)

I have enabled range checking and tried various things, but stil cant
find the cause of it. Mostly because it happens relatively rarely and
not always in the same situation.

What other options are available on iOS to find the cause?

Thanks!
Atmapuri

Janez Atmapuri ...

Posts: 58
Registered: 8/19/01
Re: Memory corruption question on iOS
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 2, 2017 11:20 PM   in response to: Janez Atmapuri ... in response to: Janez Atmapuri ...
Hi,

It appears this has to do with allocation of memory from Delphi within
Threads, which were not created within Delphi (and are possibly
associated with a different heap). At least on Windows OS this is a
known limitation, but on iOS these threads are relatively widely used.
For example, for every message box. Not sure how is this on
Android, but this issue:

https://quality.embarcadero.com/browse/RSP-17162

Is maybe a consequence of the desire to fix this problem.

Kind Regards!
Atmapuri
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02