View Issue Details

IDProjectCategoryView StatusLast Update
0035400LazarusLCLpublic2019-10-21 12:44
ReporterDavid Assigned ToDmitry Boyarintsev  
Status closedResolutionfixed 
Product Version2.0.2 
Summary0035400: TBitBtn has a Memory Leak on Cocoa
DescriptionIf you assign a bitmap to the glyph property of a bitbtn it leaks memory. OK if no glyph. Speedbutton OK.
Steps To ReproduceBuild attached demo, and run from command line to see heaptrc output. As Mac apps don't seem to send heaptrc output via lazlogger you need to do something like -


(open --args "--debug-log=/Users/dbannon/Pascal/MemLeak/log.log" no longer seems to get the heaptrc output - another issue ? )

Additional InformationClear the TBitBtn glyph and the leak goes away.
This problem appears in both Lazarus 2.0.0 and 2.0.2
TagsNo tags attached.
Fixed in Revision61160
Attached Files



2019-04-17 01:38

reporter (129,896 bytes)

jamie philbrook

2019-04-17 03:42

reporter   ~0115574

Last edited: 2019-04-17 03:43

View 2 revisions

I tried to get that source code to work on WIn10, I don't have a MAC but
I couldn't see any place where you are actually assigning the bitmap? Maybe
you posted the wrong example?

 In anycase, did you free the source of the bitmap ? Assigning an image in
most cases does not free the source of that image, you must do that.

 would be interesting to hear more.


2019-04-17 06:00

reporter   ~0115578

I set the bitmap using the object inspector. Click on the TBitBtn, go to object inspector and, under properties, Glyph, 'load'.

So, the bitmap should be set when you open the project, does the BitBtn have a little notebook image ?

Its all good on Windows by the way, no leaks !



2019-04-17 07:20

reporter   ~0115579

Jamie, you are right, I stupidly made my zip file AFTER removing the image as a test. Have attached a new zip with its image in the TBitBtn.

Note, you will need to run the app initially from within the IDE to create your own app file, my ide is ignoring my request to include the app file in the zip.


2019-04-17 08:08

reporter (130,044 bytes)

Dmitry Boyarintsev

2019-05-05 20:53

developer   ~0116026

please test and close if ok


2019-10-21 12:44

reporter   ~0118751

Yep, all fixed, thanks

Issue History

Date Modified Username Field Change
2019-04-17 01:38 David New Issue
2019-04-17 01:38 David File Added:
2019-04-17 03:42 jamie philbrook Note Added: 0115574
2019-04-17 03:43 jamie philbrook Note Edited: 0115574 View Revisions
2019-04-17 06:00 David Note Added: 0115578
2019-04-17 07:20 David Note Added: 0115579
2019-04-17 08:08 David File Added:
2019-05-05 20:53 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2019-05-05 20:53 Dmitry Boyarintsev Status new => resolved
2019-05-05 20:53 Dmitry Boyarintsev Resolution open => fixed
2019-05-05 20:53 Dmitry Boyarintsev Fixed in Revision => 61160
2019-05-05 20:53 Dmitry Boyarintsev LazTarget => -
2019-05-05 20:53 Dmitry Boyarintsev Widgetset Cocoa => Cocoa
2019-05-05 20:53 Dmitry Boyarintsev Note Added: 0116026
2019-10-21 12:44 David Status resolved => closed
2019-10-21 12:44 David Note Added: 0118751