Mauro Botta 2 Posted October 29 (edited) Hi, i have deploy my new FMX App ( Datasnap ) on Google Store. i have a error log of my app ( this bug have more of 500 users ) : Error from OS : Android 13 + 14 + 15 + 16 Mode: 90% are : background I'm using Delphi 12.3 + SKIA. My Samsung phone work with Android 16 work fine. Any Hint ? Mauro Title: [split_config.arm64_v8a.apk] System::SysFreeMem(void*) logs: Main errror: TObjectDictionary all text: pid: 0, tid: 18790 >>> com.zzzzzzzzzzzzzzzzzzz <<< backtrace: #00 pc 0x000000000005b6f0 /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) #01 pc 0x00000000000454f4 /apex/com.android.runtime/lib64/bionic/libc.so (free+108) #02 pc 0x0000000004eb0858 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::SysFreeMem(void*)+16) #03 pc 0x0000000004eaef38 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::_FreeMem(void*)+36) #04 pc 0x00000000058d538c /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Threading::TObjectCache::~TObjectCache()+40) #05 pc 0x0000000004ea9f88 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::TObject::Free()+36) #06 pc 0x00000000058d56d8 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Generics::Collections::TObjectDictionary__2<System::TMetaClass*, System::Threading::TObjectCache*>::ValueNotify(System::Threading::TObjectCache*, System::Generics::Collections::TCollectionNotification)+64) #07 pc 0x00000000058de42c /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Generics::Collections::TDictionary__2<System::TMetaClass*, System::Threading::TObjectCache*>::Clear()+244) #08 pc 0x00000000058d55ac /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Generics::Collections::TDictionary__2<System::TMetaClass*, System::Threading::TObjectCache*>::~TDictionary__2()+32) #09 pc 0x0000000004ea9f88 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::TObject::Free()+36) #10 pc 0x00000000058ec004 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Threading::ShutdownThreadPool()+60) #11 pc 0x00000000058ec094 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Threading::TThreadPool::operator cdtr()+32) #12 pc 0x0000000004ec03b0 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::FinalizeUnits()+132) #13 pc 0x0000000004ebf11c /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::_Halt0()+332) #14 pc 0x0000000004eb11a8 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::_Halt(int)+28) #15 pc 0x0000000005276358 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (Androidapi::Appglue::TAndroidApplicationGlue::OnDestroy(ANativeActivity*)+40) #16 pc 0x00000000001069f0 /system/lib64/libandroid_runtime.so (android::NativeCode::~NativeCode()+52) #17 pc 0x0000000000106174 /system/lib64/libandroid_runtime.so (android::unloadNativeCode_native(_JNIEnv*, _jobject*, long)+32) #18 pc 0x0000000000e6a920 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+112) #19 pc 0x000000000068a780 /apex/com.android.art/lib64/libart.so (nterp_helper+5648) #20 pc 0x0000000000267c70 /system/framework/framework.jar (android.app.NativeActivity.onDestroy+64) #21 pc 0x000000000068a0c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) #22 pc 0x00000000003c01e8 /data/app/~~MYAPP==/base.apk (com.embarcadero.firemonkey.FMXNativeActivity.onDestroy) #23 pc 0x00000000008e7c04 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.Activity.performDestroy+740) #24 pc 0x000000000063a514 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.Instrumentation.callActivityOnDestroy+52) #25 pc 0x000000000072f0ec /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.performDestroyActivity+764) #26 pc 0x0000000000727cb8 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.handleDestroyActivity+88) #27 pc 0x000000000090d720 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.DestroyActivityItem.execute+160) #28 pc 0x000000000066f224 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.TransactionExecutor.executeLifecycleState+324) #29 pc 0x000000000066f9d0 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.TransactionExecutor.execute+784) #30 pc 0x0000000000706ef4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread$H.handleMessage+2100) #31 pc 0x00000000009ace08 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+168) #32 pc 0x00000000009b0b9c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loopOnce+1036) #33 pc 0x00000000009b06e8 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+1112) #34 pc 0x000000000071f8f4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.main+2420) #35 pc 0x000000000032d460 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) #36 pc 0x00000000003273d0 /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+544) #37 pc 0x00000000005c6f80 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+32) #38 pc 0x0000000000e6bb04 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+116) #39 pc 0x0000000000d14034 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+132) #40 pc 0x0000000000d1e9b4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.ZygoteInit.main+3540) #41 pc 0x000000000032d460 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) #42 pc 0x000000000032bfc8 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+800) #43 pc 0x000000000064a488 /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+156) #44 pc 0x00000000000e3be8 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+108) #45 pc 0x00000000000f05bc /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+856) #46 pc 0x0000000000002558 /system/bin/app_process64 (main+1280) #47 pc 0x0000000000053df8 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) Edited October 30 by Mauro Botta Share this post Link to post
Dave Nottage 662 Posted October 29 7 hours ago, Mauro Botta said: Any Hint ? One hint: the problem is not FMXNativeActivity.onDestroy. There is an instance of a TObjectDictionary being free'd when units are finalized: #12 pc 0x0000000004ec03b0 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::FinalizeUnits()+132) #05 pc 0x0000000004ea9f88 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::TObject::Free()+36) #06 pc 0x00000000058d56d8 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Generics::Collections::TObjectDictionary__2<System::TMetaClass*, System::Threading::TObjectCache*>::ValueNotify(System::Threading::TObjectCache*, The TObjectDictionary would be the FObjectCaches class member of TThreadPool, since the problem starts there: #10 pc 0x00000000058ec004 /data/app/~~MYAPP==/split_config.arm64_v8a.apk (System::Threading::ShutdownThreadPool()+60) In line #06 of the callstack, the problem starts in the ValueNotify method of TObjectDictionary: procedure TObjectDictionary<K,V>.ValueNotify(const Value: V; Action: TCollectionNotification); begin inherited; if (Action = cnRemoved) and (doOwnsValues in FOwnerships) then PObject(@Value)^.Free; // <----- Problem is here end; The most likely cause is that whatever object it is, has already been free'd, thus the crash. I don't know enough about TThreadPool and its object cache to be of any further use. Perhaps someone else can chime in, however there was a report of a very similar problem 4 years ago. 1 Share this post Link to post
alejandro.sawers 20 Posted October 30 (edited) I tried to understand this issue back in the day by diving into the RTL code, but as I was not able to reproduce it using several phones I gave up. I thought this issue eventually got mitigated with some new Delphi version, as my Play Store reports now show just 1 event in the last two months, but if you're using Delphi 12.3 then the issue is still there. Just a wild guess: 90% of crashes in the background could be a hint of Android killing your app on the background (for whatever reason), and maybe this way of closing the app causes the RTL to shutdown abnormally. You can try running your app on your phone (on debug mode) and simulate the scenario that kills your app, whether is RAM shortage, or Doze mode kicking in, or the user running a "Close all apps" routine. Other than that, I have no clue of what could be going on. Update: I see you have the "Pointer tag for 0x... was truncated" message in your Play Store crash report. Now I remember adding this to my AndroidManifest.template.xml file: <application ... android:allowNativeHeapPointerTagging="false" ... > Can't remember if this caused my crashes to drop, but you can try. Edited October 30 by alejandro.sawers 1 Share this post Link to post
DiegoR 1 Posted November 3 (edited) Hi Mauro! i have same issue in some of my app ... In a blank new test app, with button and showmessage it works well... I tried a lot of changes , specially in my own task management, but without success 😞 so i think it can be related to some usage of other task or google services, like maps or notification. I had to publish the update so, I'h to use the same workaround : allowNativeHeapPointerTagging ... I'll update this topic if find some other infos. ps: Delphi 13 🙂 Edited November 3 by DiegoR Share this post Link to post
Mauro Botta 2 Posted November 3 Hi @alejandro.sawers The tag : android:allowNativeHeapPointerTagging ="false" have FIXED ALL my problems, i can see the true Store stack errors now. 1 Share this post Link to post
DiegoR 1 Posted November 3 in my case, every time App had to close , it log this event and sometimes Android report a "bug" to the users. I'm stuck finding the task which create the AV during TThreadPool free. it's an instance of TObjectCache into TThreadPool, but was impossible for me to find class name or other useful tips.. i confirm the android:allowNativeHeapPointerTagging ="false" workaround but it's only a temp solution, Google declare it with an expiration date! Share this post Link to post
Mauro Botta 2 Posted November 3 47 minutes ago, DiegoR said: in my case, every time App had to close , it log this event and sometimes Android report a "bug" to the users. I'm stuck finding the task which create the AV during TThreadPool free. it's an instance of TObjectCache into TThreadPool, but was impossible for me to find class name or other useful tips.. i confirm the android:allowNativeHeapPointerTagging ="false" workaround but it's only a temp solution, Google declare it with an expiration date! // i confirm the android:allowNativeHeapPointerTagging ="false" workaround but it's only a temp solution, Google declare it with an expiration date! Yes, but .. Can to be a Delphi Bug 12 / 13 bug ? Share this post Link to post
alejandro.sawers 20 Posted November 4 On 11/3/2025 at 7:15 AM, Mauro Botta said: The tag : android:allowNativeHeapPointerTagging ="false" have FIXED ALL my problems Glad it worked. 22 hours ago, Mauro Botta said: but it's only a temp solution, Google declare it with an expiration date! You're right. As explained in the official docs, the workaround "does not address the underlying code health problem", but given Emba closed this without a solution chances are they won't work on it until Google gives a proper deadline. Share this post Link to post