Recent

Author Topic: [Problem solved] Wish: stop the race after Delphi  (Read 16366 times)

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #15 on: December 27, 2020, 03:19:09 pm »
Attached the Valgrind messages:
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Wish: stop the race after Delphi
« Reply #16 on: December 27, 2020, 03:48:40 pm »
Attached the Valgrind messages: [...]

Nitpicking, I know, but when attaching the output of a command line program it's almost always better to do it as a text file, either redirecting the output to a file or copying it from the terminal (almost all have facilities for this) and paste it to a text file using whatever editor you like.

It's always easier viewing/editing text than an image. ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #17 on: December 27, 2020, 04:00:12 pm »
Attached the Valgrind messages: [...]

Nitpicking, I know, but when attaching the output of a command line program it's almost always better to do it as a text file, either redirecting the output to a file or copying it from the terminal (almost all have facilities for this) and paste it to a text file using whatever editor you like.

It's always easier viewing/editing text than an image. ;)

I thought it will keep the formatting better this way... no problem to redirect it to a file next time.
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: Wish: stop the race after Delphi
« Reply #18 on: December 27, 2020, 04:22:11 pm »
Two hours have passed, no crash. I moved my mouse, clicked the form here and there. Nothing bad happened. So, I can say the issue is not Lazarus GTK2 related.

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #19 on: December 27, 2020, 04:34:13 pm »
Two hours have passed, no crash. I moved my mouse, clicked the form here and there. Nothing bad happened. So, I can say the issue is not Lazarus GTK2 related.

Thank you for your test. Were you able to see these dialogs? Even with gtk2 there are memory leaks...
The green and gray "pins" are click-able and launch another configuration dialog...
« Last Edit: December 27, 2020, 04:36:10 pm by funlw65 »
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Wish: stop the race after Delphi
« Reply #20 on: December 27, 2020, 04:46:40 pm »
This is the zip version. I removed the binary because the size is 8 MB.
Thanks!
Did you extract and copy the files through Google Drive and then created a new ZIP package?

@funlw65, how to test your app? "Setting Environment" asks for "Toolchain folder" and such. What folder should I choose? There is no initial directory to start with.

Quote
Even with gtk2 there are memory leaks...
Blame yourself for that.
For example Lazarus IDE built with GTK2 or QT5 has no memory leaks after hours of intense work.
« Last Edit: December 27, 2020, 04:50:34 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #21 on: December 27, 2020, 04:56:11 pm »
Hi, you need to read the Readme from the repository (link on the first page of this thread). When you enter in the repository, you must scroll the page down and read the description and the little tutorial. There is also a movie that shows step by step how to set the environment.

The application won't work if the environment is not set correctly because the main objective is to have a C toolchain for programming the STM32 microcontroller. It does some checks then complain if those things are not there, in your home folder.

In my experience, the app works perfect and the project generated in C language compiles without errors in arm-gcc. It saves the project correctly, it loads correctly, I don't have problems with the way the app works. It works as intended. But it leaks heavily and not from my code as I do not use custom objects or allocate memory. But you can see that looking at the code. If I use qt5 it crashes.
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: Wish: stop the race after Delphi
« Reply #22 on: December 27, 2020, 04:57:44 pm »
Attached the Valgrind messages:
Are you sure you compiled with -gv ?
Also to be save, set debug info to dwarf ( -gw ). (I would think gv includes that, but...)

This would be the first app I have seen where valgrind did not at least give a false positive an "uninitialized ...in condition" or "reading 1 byte ... past the end of ..."



Just starting and stopping indeed brings up no errors. (I use gtk2, since I haven't got qt installed)
I do not have the toolchain, so I can't really test anything else.
« Last Edit: December 27, 2020, 05:15:14 pm by Martin_fr »

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #23 on: December 27, 2020, 05:02:58 pm »
This was before the image I posted:

Code: Text  [Select][+][-]
  1. [methevac@me-pc vsc_stm32l1_projects]$ cd vpc
  2. [methevac@me-pc vpc]$ valgrind --tool=memcheck ./vpc
  3. ==509== Memcheck, a memory error detector
  4. ==509== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  5. ==509== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
  6. ==509== Command: ./vpc
  7. ==509==
  8.  
  9. (vpc:509): dbind-WARNING **: 16:01:14.321: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
  10. qt5ct: using qt5ct plugin
  11. qt5ct: D-Bus global menu: no
  12. ==509== Syscall param writev(vector[...]) points to uninitialised byte(s)
  13. ==509==    at 0x4D63537: __writev (writev.c:26)
  14. ==509==    by 0x4D63537: writev (writev.c:24)
  15. ==509==    by 0x6516FDC: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  16. ==509==    by 0x65173B0: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  17. ==509==    by 0x651743C: xcb_writev (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  18. ==509==    by 0x4B7586D: _XSend (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
  19. ==509==    by 0x4B759A3: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
  20. ==509==    by 0x65170E5: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  21. ==509==    by 0x6517164: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  22. ==509==    by 0x6517690: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  23. ==509==    by 0x651792B: xcb_send_request_with_fds64 (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  24. ==509==    by 0x6517CF8: xcb_send_request (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  25. ==509==    by 0x651E5F0: xcb_change_property (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  26. ==509==  Address 0x91f4244 is 36 bytes inside a block of size 16,384 alloc'd
  27. ==509==    at 0x4837B65: calloc (vg_replace_malloc.c:752)
  28. ==509==    by 0x4B65B15: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
  29. ==509==    by 0x98FBE0D: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.11.3)
  30. ==509==    by 0x98FFC4E: QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.11.3)
  31. ==509==    by 0x485326C: ??? (in /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so)
  32. ==509==    by 0x56110C2: QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  33. ==509==    by 0x561F33D: QGuiApplicationPrivate::createPlatformIntegration() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  34. ==509==    by 0x562039C: QGuiApplicationPrivate::createEventDispatcher() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  35. ==509==    by 0x5EA7FA4: QCoreApplicationPrivate::init() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  36. ==509==    by 0x562137E: QGuiApplicationPrivate::init() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  37. ==509==    by 0x5010F88: QApplicationPrivate::init() (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  38. ==509==    by 0x4A075C0: QApplication_Create (in /usr/lib/x86_64-linux-gnu/libQt5Pas.so.1.2.6)
  39. ==509==
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #24 on: December 27, 2020, 05:09:35 pm »
Ok, I did what you said last time and I had a "reaction" from Valgrind after I closed the "Clock" dialog...

Code: Text  [Select][+][-]
  1. [methevac@me-pc vpc]$ valgrind --tool=memcheck ./vpc
  2. ==8590== Memcheck, a memory error detector
  3. ==8590== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  4. ==8590== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
  5. ==8590== Command: ./vpc
  6. ==8590==
  7.  
  8. (vpc:8590): dbind-WARNING **: 18:04:46.936: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
  9. qt5ct: using qt5ct plugin
  10. qt5ct: D-Bus global menu: no
  11. ==8590== Syscall param writev(vector[...]) points to uninitialised byte(s)
  12. ==8590==    at 0x4D63537: __writev (writev.c:26)
  13. ==8590==    by 0x4D63537: writev (writev.c:24)
  14. ==8590==    by 0x6516FDC: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  15. ==8590==    by 0x65173B0: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  16. ==8590==    by 0x651743C: xcb_writev (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  17. ==8590==    by 0x4B7586D: _XSend (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
  18. ==8590==    by 0x4B759A3: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
  19. ==8590==    by 0x65170E5: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  20. ==8590==    by 0x6517164: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  21. ==8590==    by 0x6517690: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  22. ==8590==    by 0x651792B: xcb_send_request_with_fds64 (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  23. ==8590==    by 0x6517CF8: xcb_send_request (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  24. ==8590==    by 0x651E5F0: xcb_change_property (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  25. ==8590==  Address 0x91f4264 is 36 bytes inside a block of size 16,384 alloc'd
  26. ==8590==    at 0x4837B65: calloc (vg_replace_malloc.c:752)
  27. ==8590==    by 0x4B65B15: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
  28. ==8590==    by 0x98FBE0D: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.11.3)
  29. ==8590==    by 0x98FFC4E: QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.11.3)
  30. ==8590==    by 0x485326C: ??? (in /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so)
  31. ==8590==    by 0x56110C2: QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  32. ==8590==    by 0x561F33D: QGuiApplicationPrivate::createPlatformIntegration() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  33. ==8590==    by 0x562039C: QGuiApplicationPrivate::createEventDispatcher() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  34. ==8590==    by 0x5EA7FA4: QCoreApplicationPrivate::init() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  35. ==8590==    by 0x562137E: QGuiApplicationPrivate::init() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.11.3)
  36. ==8590==    by 0x5010F88: QApplicationPrivate::init() (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  37. ==8590==    by 0x4A075C0: QApplication_Create (in /usr/lib/x86_64-linux-gnu/libQt5Pas.so.1.2.6)
  38. ==8590==
  39. ==8590== Invalid write of size 8
  40. ==8590==    at 0x4A7B96B: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Pas.so.1.2.6)
  41. ==8590==    by 0x5ECA7F5: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  42. ==8590==    by 0x5ECAE7E: QObject::destroyed(QObject*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  43. ==8590==    by 0x5045EFA: QWidget::~QWidget() (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  44. ==8590==    by 0x5046008: QWidget::~QWidget() (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  45. ==8590==    by 0x5EC875A: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  46. ==8590==    by 0x5045E05: QWidget::~QWidget() (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  47. ==8590==    by 0x5046008: QWidget::~QWidget() (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  48. ==8590==    by 0x5ECB08F: QObject::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  49. ==8590==    by 0x504A96A: QWidget::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  50. ==8590==    by 0x500C4C0: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  51. ==8590==    by 0x501396F: QApplication::notify(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.11.3)
  52. ==8590==  Address 0x1245e5f0 is 16 bytes inside a block of size 56 free'd
  53. ==8590==    at 0x483708B: operator delete(void*, unsigned long) (vg_replace_malloc.c:585)
  54. ==8590==    by 0x7A77F7: QTOBJECTS$_$TQTOBJECT_$__$$_DETACHEVENTS (qtobjects.pas:1109)
  55. ==8590==    by 0x789A6E: QTWIDGETS$_$TQTMAINWINDOW_$__$$_DETACHEVENTS (qtwidgets.pas:8131)
  56. ==8590==    by 0x77E0D2: QTWIDGETS$_$TQTWIDGET_$__$$_DEINITIALIZEWIDGET (qtwidgets.pas:2168)
  57. ==8590==    by 0x7A14FA: QTWIDGETS$_$TQTHINTWINDOW_$__$$_DEINITIALIZEWIDGET (qtwidgets.pas:18307)
  58. ==8590==    by 0x77E2EA: QTWIDGETS$_$TQTWIDGET_$__$$_DESTROY (qtwidgets.pas:2230)
  59. ==8590==    by 0x7882FC: QTWIDGETS$_$TQTMAINWINDOW_$__$$_DESTROY (qtwidgets.pas:7082)
  60. ==8590==    by 0x435C6A: SYSTEM$_$TOBJECT_$__$$_FREE (in /home/methevac/vsc_stm32l1_projects/vpc/vpc)
  61. ==8590==    by 0x77E40A: QTWIDGETS$_$TQTWIDGET_$__$$_RELEASE (qtwidgets.pas:2270)
  62. ==8590==    by 0x77E43A: QTWIDGETS$_$TQTWIDGET_$__$$_DESTROYED (qtwidgets.pas:2276)
  63. ==8590==    by 0x4A7B96A: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Pas.so.1.2.6)
  64. ==8590==    by 0x5ECA7F5: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.11.3)
  65. ==8590==  Block was alloc'd at
  66. ==8590==    at 0x4835DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
  67. ==8590==    by 0x49D39A6: QObject_hook_Create (in /usr/lib/x86_64-linux-gnu/libQt5Pas.so.1.2.6)
  68. ==8590==    by 0x7A7778: QTOBJECTS$_$TQTOBJECT_$__$$_ATTACHEVENTS (qtobjects.pas:1096)
  69. ==8590==    by 0x789951: QTWIDGETS$_$TQTMAINWINDOW_$__$$_ATTACHEVENTS (qtwidgets.pas:8099)
  70. ==8590==    by 0x856E38: QTWSFORMS$_$TQTWSHINTWINDOW_$__$$_CREATEHANDLE$TWINCONTROL$TCREATEPARAMS$$TLCLINTFHANDLE (qtwsforms.pp:1052)
  71. ==8590==    by 0x6E5454: CONTROLS$_$TWINCONTROL_$__$$_CREATEWND (wincontrol.inc:7537)
  72. ==8590==    by 0x44FB46: FORMS$_$TSCROLLINGWINCONTROL_$__$$_CREATEWND (scrollingwincontrol.inc:23)
  73. ==8590==    by 0x45938C: FORMS$_$TCUSTOMFORM_$__$$_CREATEWND (customform.inc:2703)
  74. ==8590==    by 0x6E4BFF: CONTROLS$_$TWINCONTROL_$__$$_CREATEHANDLE (wincontrol.inc:7447)
  75. ==8590==    by 0x6E63B7: CONTROLS$_$TWINCONTROL_$__$$_HANDLENEEDED (wincontrol.inc:7900)
  76. ==8590==    by 0x6D1CCA: CONTROLS$_$TCONTROLCANVAS_$__$$_CREATEHANDLE (controlcanvas.inc:96)
  77. ==8590==    by 0x639F6D: GRAPHICS$_$TCANVAS_$__$$_REQUIREDSTATE$TCANVASSTATE (canvas.inc:1699)
  78. ==8590==
  79.  
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #25 on: December 27, 2020, 05:13:23 pm »
I excluded the last part with the memory leaks (as in the picture I posted and got the advice to provide only text)
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Wish: stop the race after Delphi
« Reply #26 on: December 27, 2020, 05:21:36 pm »
But it leaks heavily and not from my code as I do not use custom objects or allocate memory.
Hmmm...
Indeed I don't find anything by a search ".Create" except for Application.CreateForm() calls in the main .lpr file.
It means you don't use any objects anywhere except for the streamed visual components on the auto-created forms. You don't even use DataModules.
Interesting!

Functions like ReadXMLFile() in fcl create an object which must by freed by a caller.
You free the Doc objects, OK, but you should use try...finally blocks to be sure.
« Last Edit: December 27, 2020, 05:28:45 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: Wish: stop the race after Delphi
« Reply #27 on: December 27, 2020, 05:25:45 pm »
I am not sure about the syscall, but would tend to ignore that one. From the stack, if it is anything it is deep inside QT. And it is very unlikely to be caused by anything in the LCL or Lazarus supplied code (let alone yours).

The
Code: Text  [Select][+][-]
  1. ==8590== Invalid write of size 8
does look suspicious.
Code: Text  [Select][+][-]
  1.  is ... bytes inside a block of size ... free'd
is always a bad sign.

The traces are not long enough to say something definitive. (you can increase the length by --num-callers=50 )
And also I am not the expert on QT, or the Lazarus QT wrapper...

There is a (imho) good chance that the memory free and later access are triggered by something either in the Lazarus Code or yours.

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #28 on: December 27, 2020, 05:28:37 pm »
This is the zip version. I removed the binary because the size is 8 MB.
Thanks!
Did you extract and copy the files through Google Drive and then created a new ZIP package?

@funlw65, how to test your app? "Setting Environment" asks for "Toolchain folder" and such. What folder should I choose? There is no initial directory to start with.

Quote
Even with gtk2 there are memory leaks...
Blame yourself for that.
For example Lazarus IDE built with GTK2 or QT5 has no memory leaks after hours of intense work.

Juha, you should be able to download the archive as it is, there must be a button with a down arrow...
BTW, the application was tested exclusively in Linux as it uses the paths specific to unix-like systems. I know there is a function that translates the linux paths in Windows compatible paths but I didn't bothered to include that in the code. That is all you have to do in the code to be able to work in Windows but there are so many places to make the modifications, that it will be easier to migrate to Linux :D
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

funlw65

  • Full Member
  • ***
  • Posts: 148
    • Visual Pin Configurator for Nucleo 64pin boards
Re: Wish: stop the race after Delphi
« Reply #29 on: December 27, 2020, 05:31:45 pm »
But it leaks heavily and not from my code as I do not use custom objects or allocate memory.
Hmmm...
Indeed I don't find anything by a search ".Create" except for Application.CreateForm() calls in the main .lpr file.
It means you don't use any objects anywhere except for the streamed visual components on the auto-created forms. You don't even use DataModules.
Interesting!

Functions like ReadXMLFile() in fcl create an object which must by freed by a caller.
You free the Doc objects, OK, but you should use try...finally blocks to be sure.

Exactly! That is why I am discouraged and thinking to use qtcreator and C++ for my application. And is a pity... I really love Pascal and Lazarus+FreePascal is amazing - at least, the possibilities...
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

 

TinyPortal © 2005-2018