Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi-BCB/FireMonkey/Runtime    [ Add a report in this area ]  
Report #:  127963   Status: Resolved
[MacOS] FMX application has huge memory leaks - TPlatformCocoa.Destroy is never called
Project:  Delphi Build #:  21.0.17017.3725
Version:    21.0 Submitted By:   Dirk Carstensen
Report Type:  Basic functionality failure Date Reported:  9/30/2014 5:23:17 AM
Severity:    Serious / Highly visible problem Last Updated: 12/24/2014 4:42:13 PM
Platform:    All Mac platforms Internal Tracking #:   55507
Resolution: Checked In (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (3 Total Ratings)
5.00 out of 5
Total Votes: 26
Description
A simple empty XE7 FMX application leaks memory.
TPlatformCocoa.Destroy is never called
Steps to Reproduce:
- Create empty FMX application with target MacOS
- use latest FastMM4 for leak detection from https://svn.code.sf.net/p/fastmm/code
- Add FastMM4 to uses clause (first in dpr)
- set compilerswitch FullDebugMode
- add libFastMM_FullDebugMode.dylib to deployment
- add detailed map to deployment
- start application and close it


Expected: no leaks

Found:

This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):

5 - 12 bytes: Unknown x 2376
13 - 20 bytes: Unknown x 1500
21 - 36 bytes: Unknown x 678
37 - 52 bytes: Unknown x 882
53 - 68 bytes: Unknown x 113
69 - 84 bytes: Unknown x 6
85 - 100 bytes: Unknown x 306
101 - 116 bytes: Unknown x 527
117 - 132 bytes: Unknown x 52
133 - 148 bytes: Unknown x 13
165 - 180 bytes: Unknown x 13
181 - 212 bytes: Unknown x 6
213 - 244 bytes: Unknown x 11
245 - 276 bytes: Unknown x 1
277 - 308 bytes: Unknown x 1
389 - 436 bytes: Unknown x 2
437 - 484 bytes: Unknown x 1
485 - 532 bytes: Unknown x 2
597 - 660 bytes: Unknown x 1
821 - 916 bytes: Unknown x 2
917 - 1012 bytes: Unknown x 3
1365 - 1508 bytes: Unknown x 2
1509 - 1668 bytes: Unknown x 5
1669 - 1844 bytes: Unknown x 1
1845 - 2036 bytes: Unknown x 1

The sizes of leaked medium and large blocks are (excluding expected leaks registered by pointer): 6820, 6820, 6308, 4004, 6308

Note: Memory leak detail is logged to a text file in the same folder as this application. To disable this memory leak check, undefine "EnableMemoryLeakReporting".


leaked memory for example:
--------------------------------114/8/30 13:16:25--------------------------------
A memory block has been leaked. The size is: 52

This block was allocated by thread 0xA07B21A8, and the stack trace (return addresses) at the time was:
00028ACF FastMM4.DebugGetMem
000112D0 System.@ReallocMem
0001C4F4 System.@DynArraySetLength
000908B8 System.Rtti.TRawVirtualClass.TVTable.Create
000D318C Macapi.ObjectiveC.TOCVTable.Create
0017EB52 Macapi.Foundation.{Macapi.ObjectiveC}TOCGenericImport<Macapi.Foundation.NSTimerClass,Macapi.Foundation.NSTimer>.GetOCClass
0048562D FMX.Platform.Mac.TPlatformCocoa.CreateTimer
005282BD FMX.Forms.TApplication.SetupActionTimer
00527B30 FMX.Forms.TApplication.DoIdle
00483A42 FMX.Platform.Mac.Idle
00483ED1 FMX.Platform.Mac.TPlatformCocoa.HookObserverCallback


So i'm unable to check for my own memory leaks because of huge number of entries. Log-file has 16MB size..


Another step to reproduce:
- Add FMX.Platform.MAC to project
- Place a breakpoint in TPlatformCocoa.Create
- Place a breakpoint in TPlatformCocoa.Destroy

Expected:

Debugger stops both in constructor and destructor

Found:

TPlatformCocoa.Destroy is never called

:-(

Workarounds
Please provide a solution for this bug
Attachment
None
Comments

Dirk Carstensen at 11/14/2014 3:18:33 AM -
This issue is not fixed in XE7 update1. Why?

Server Response from: ETNACODE01