LoadCursorFromLazarusResource leaks memory in Carbon
Original Reporter info from Mantis: piotrem
-
Reporter name: Piotr Karasinski
Original Reporter info from Mantis: piotrem
- Reporter name: Piotr Karasinski
Description:
LoadCursorFromLazarusResource causes memory leaks in Mac OS X on Carbon. It's observable in any project using this function, also in lazarus/examples/cursors, so I won't upload my own example.
Here's output of HeapTrc after executing this example project and closing it right after - to me it indicates that the problem lies in LCL Carbon particularly:
Heap dump by heaptrc unit
3116 memory blocks allocated : 167038/176104
3112 memory blocks freed : 158742/167800
4 unfreed memory blocks : 8296
True heap size : 753664 (96 used in System startup)
True free heap : 744960
Should be : 745008
Call trace for block $01667780 size 4096
$001546C3 TCARBONWIDGETSET__RAWIMAGE_CREATEBITMAPS, line 380 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0013FA76 RAWIMAGE_CREATEBITMAPS, line 159 of /Users/Shared/lazarus/trunk/lcl/lclintf.pas
$0014EC9C CREATE32BITALPHABITMAP, line 430 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0014ED37 TCARBONWIDGETSET__CREATEICONINDIRECT, line 458 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$000DA549 TCURSORIMAGE__HANDLENEEDED, line 193 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000DA407 TCURSORIMAGE__RELEASEHANDLE, line 159 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000C2652 LOADCURSORFROMLAZARUSRESOURCE, line 2093 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000403C1 TSCREEN__GETCURSORS, line 601 of /Users/Shared/lazarus/trunk/lcl/forms.pp
Call trace for block $016AAEE0 size 52
$001546C3 TCARBONWIDGETSET__RAWIMAGE_CREATEBITMAPS, line 380 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0013FA76 RAWIMAGE_CREATEBITMAPS, line 159 of /Users/Shared/lazarus/trunk/lcl/lclintf.pas
$0014EC9C CREATE32BITALPHABITMAP, line 430 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0014ED37 TCARBONWIDGETSET__CREATEICONINDIRECT, line 458 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$000DA549 TCURSORIMAGE__HANDLENEEDED, line 193 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000DA407 TCURSORIMAGE__RELEASEHANDLE, line 159 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000C2652 LOADCURSORFROMLAZARUSRESOURCE, line 2093 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000403C1 TSCREEN__GETCURSORS, line 601 of /Users/Shared/lazarus/trunk/lcl/forms.pp
Call trace for block $0166A470 size 4096
$001546C3 TCARBONWIDGETSET__RAWIMAGE_CREATEBITMAPS, line 380 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0013FA76 RAWIMAGE_CREATEBITMAPS, line 159 of /Users/Shared/lazarus/trunk/lcl/lclintf.pas
$0014EC9C CREATE32BITALPHABITMAP, line 430 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0014ED37 TCARBONWIDGETSET__CREATEICONINDIRECT, line 458 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$000DA549 TCURSORIMAGE__HANDLENEEDED, line 193 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000DA407 TCURSORIMAGE__RELEASEHANDLE, line 159 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000C2652 LOADCURSORFROMLAZARUSRESOURCE, line 2093 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$0004933B TFORM1__FORMCREATE, line 56 of /Users/Shared/lazarus/trunk/examples/cursors/unit1.pas
Call trace for block $016AAAE0 size 52
$001546C3 TCARBONWIDGETSET__RAWIMAGE_CREATEBITMAPS, line 380 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0013FA76 RAWIMAGE_CREATEBITMAPS, line 159 of /Users/Shared/lazarus/trunk/lcl/lclintf.pas
$0014EC9C CREATE32BITALPHABITMAP, line 430 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$0014ED37 TCARBONWIDGETSET__CREATEICONINDIRECT, line 458 of /Users/Shared/lazarus/trunk/lcl/interfaces//Developer/lazarus/lcl/interfaces/carbon/carbonint.pas
$000DA549 TCURSORIMAGE__HANDLENEEDED, line 193 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000DA407 TCURSORIMAGE__RELEASEHANDLE, line 159 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$000C2652 LOADCURSORFROMLAZARUSRESOURCE, line 2093 of /Users/Shared/lazarus/trunk/lcl/graphics.pp
$0004933B TFORM1__FORMCREATE, line 56 of /Users/Shared/lazarus/trunk/examples/cursors/unit1.pas
Additional information:
My configuration is as follows:
Lazarus from SVN trunk, rev. 34340
FPC 2.6.0 from SVN, fixes_2_6 branch, rev. 19877 (let me know if you'd like me to try it on different version of FPC, though I don't think it matters)
Mac OS X 10.7.2
Mantis conversion info:
- Mantis ID: 20944
- Version: 0.9.31 (SVN)
- Monitored by: » piotrem (Piotr Karasinski)