KMarb 5 Posted September 8, 2022 Delphi 11.1, creating android apps In researching other topics I found some discussion that android is a different beast in terms of memory management, and maybe we should no longer call free or freeAndNil? I haven't had an issue until now... The following code blows up: freeAndNil (SyncCDS); freeAndNil (SyncQuery); When earlier in the execution, I called this code: SyncQuery := TFDQuery.Create (nil); SyncQuery.Connection := DMConn.dbcMain; SyncCDS := TClientDataSet.Create (nil); Not sure it matters but this code is running in a TTask.Run procedure. Can someone please explain the (new) mindset around allocating and freeing objects in android please. Share this post Link to post
Lajos Juhász 293 Posted September 8, 2022 10 minutes ago, KMarb said: Delphi 11.1, creating android apps In researching other topics I found some discussion that android is a different beast in terms of memory management, and maybe we should no longer call free or freeAndNil? This was correct until Delphi 10.4 when ARC ( Automatic Reference Counting) was removed. Now you code the same way on all of the platforms and have to call free or if you must call freeAndNil (freeAndNil is in 99.999999999999999999% a code smell.) Share this post Link to post