View Issue Details

IDProjectCategoryView StatusLast Update
0034951LazarusLCLpublic2019-04-22 19:38
ReporterTimm Thaler Assigned ToMichl  
Status resolvedResolutionfixed 
PlatformRaspberry Pi / ARMOSRaspbian / other Linux 
Target Version2.0Fixed in Version2.1 (SVN) 
Summary0034951: Memleak in TStatusBar with GTK2
DescriptionIf the panel text in a TStatusbar is updated with different content (e.g. timer, event counter...), the used program memory rises permanently.
Steps To Reproduceput a TStatusBar with one Panel to a Form
put a Timer to that Form, set it to 10msec
update the statusbar every timer event with changing content

  If cykl >= 50 then cykl := 1;
  sts_bar.Panels[0].Text := StringOfChar('I', cykl);

see the used memory in the Taskmanager rising.
Additional InformationThis happens with GTK2 widgetset in Linux, but not with WinApi widgetset in Windows.

It seems only to happen if the new content is different.
TagsNo tags attached.
Fixed in Revision60250
Attached Files


related to 0031204 closedMichl Changing of StaticText caption increase memory 


Martin Friebe

2019-01-27 03:55

manager   ~0113651

r40963 is not the lazarus build, is it?

1) Does it happen on other Linux too? I tried with Fedora 28 but no memory growth.
It is possible that there is an issue in gtk itself too.

2) Does heaptrc show any traces? -gh

3) if heaptrc does not, can you try valgrind?
You need to:
- use latest lazarus trunk (there were other leaks fixed yesterday)
- add "uses cmem" open ide/lazarus.pp and as very first unit in the uses clause add cmem.
- recompile with -gw
Then run
  valgrind --log-file=somefile.trc --tool=memcheck --leak-check=full --num-callers=30 ./lazarus

Attach the log.

Timm Thaler

2019-01-27 16:40

reporter   ~0113672

r40963 ist the FPC build cause I thought it is an FPC issue.

Lazarus version: 2.0.0RC3
Lazarus svn revision: 60205
Lazarus build date: 2019/01/25
FPC Version=3.2.0-beta-r40963
crosscompile for linux/arm

on Raspberry Pi I run
Lazarus version: 1.8.4
Lazarus svn revision: 58671M
FPC Version=3.0.4-r37149
its difficult to update to latest trunk, I mostly crosscompile from PC

heaptrace gives no result. GTK2 on Raspberry is up-to-date. Maybe it is a problem within GTK for arm.

Here it was confirmed but this was two years ago.

Martin Friebe

2019-01-28 01:46

manager   ~0113683

Last edited: 2019-01-28 01:49

View 5 revisions

Well not sure how easy it will be for you to install valgrind. If you can't do trunk, then use RC3.

If you can try to patch in the following:

Be aware, that your app will be extremely slow in valgrind. So best if it does not need any interaction from your site.

It MUST be compiled with -gw (dwarf)
And that also goes for ALL packages. Set in the Tools -> config build ide dialog.
And remember: uses cmem


2019-01-30 22:59

developer   ~0113749

Fixed in trunk revision 60250. Please test and close if ok.

Issue History

Date Modified Username Field Change
2019-01-26 14:32 Timm Thaler New Issue
2019-01-26 14:37 Jonas Maebe Project FPC => Lazarus
2019-01-27 03:55 Martin Friebe Note Added: 0113651
2019-01-27 14:49 Michl Relationship added related to 0031204
2019-01-27 16:40 Timm Thaler Note Added: 0113672
2019-01-28 01:46 Martin Friebe Note Added: 0113683
2019-01-28 01:46 Martin Friebe Note Edited: 0113683 View Revisions
2019-01-28 01:47 Martin Friebe Note Edited: 0113683 View Revisions
2019-01-28 01:48 Martin Friebe Note Edited: 0113683 View Revisions
2019-01-28 01:49 Martin Friebe Note Edited: 0113683 View Revisions
2019-01-30 22:52 Michl Assigned To => Michl
2019-01-30 22:52 Michl Status new => assigned
2019-01-30 22:59 Michl Fixed in Revision => 60250
2019-01-30 22:59 Michl LazTarget => -
2019-01-30 22:59 Michl Note Added: 0113749
2019-01-30 22:59 Michl Status assigned => resolved
2019-01-30 22:59 Michl Fixed in Version => 2.1 (SVN)
2019-01-30 22:59 Michl Resolution open => fixed
2019-01-30 22:59 Michl Target Version => 2.0