Forum > Packages and Libraries

[SOLVED] FPSpreadSheet, ReadAsText seems to create Memory leak

<< < (2/4) > >>

andresayang:
So,
There is a big problem somewhere ... this is what I do obtain, simply by pushing "run" ...
(288 unfreed memory blocks means memory leaks I guess)


--- Quote ---Heap dump by heaptrc unit of /home/geo1/Lazarus/Previous/TestMemLeaks/project1
1409448 memory blocks allocated : 218902392/220173824
1409160 memory blocks freed     : 218861509/220132576
288 unfreed memory blocks : 40883
True heap size : 2588672
True free heap : 2482944
Should be : 2492128
Call trace for block $00007FA7C8E03800 size 29
  $00000000006274AD  DOATTRTEXT,  line 3858 of laz2_xmlread.pas
  $0000000000621A27  EXPECTATTVALUE,  line 2010 of laz2_xmlread.pas
  $0000000000625E78  PARSEATTRIBUTE,  line 3542 of laz2_xmlread.pas
  $0000000000625A0F  PARSEELEMENT,  line 3411 of laz2_xmlread.pas
  $00000000006253DF  PARSECONTENT,  line 3255 of laz2_xmlread.pas
  $0000000000620E6B  PROCESSXML,  line 1710 of laz2_xmlread.pas
  $000000000061E2F2  PARSE,  line 925 of laz2_xmlread.pas
  $000000000063B900  READXMLSTREAM,  line 334 of source/common/fpsxmlcommon.pas
  $00000000005A800B  READEMBEDDEDOBJS,  line 2809 of source/common/xlsxooxml.pas
  $00000000005AEB0B  READFROMSTREAM,  line 4565 of source/common/xlsxooxml.pas
  $000000000055C181  READFROMFILE,  line 589 of source/common/fpsreaderwriter.pas
  $0000000000499F16  READFROMFILE,  line 6579 of source/common/fpspreadsheet.pas
  $000000000049A442  READFROMFILE,  line 6646 of source/common/fpspreadsheet.pas
  $0000000000401A81  ReadExcelFileData,  line 93 of project1.lpr
  $00000000004014D8  DoRun,  line 57 of project1.lpr
  $0000000000483C99
Call trace for block $00007FA7C90C1280 size 92
  $00000000006274AD  DOATTRTEXT,  line 3858 of laz2_xmlread.pas
  $0000000000621A27  EXPECTATTVALUE,  line 2010 of laz2_xmlread.pas
  $0000000000625E78  PARSEATTRIBUTE,  line 3542 of laz2_xmlread.pas
  $0000000000625A0F  PARSEELEMENT,  line 3411 of laz2_xmlread.pas
  $00000000006253DF  PARSECONTENT,  line 3255 of laz2_xmlread.pas
  $0000000000620E6B  PROCESSXML,  line 1710 of laz2_xmlread.pas
  $000000000061E2F2  PARSE,  line 925 of laz2_xmlread.pas
  $000000000063B900  READXMLSTREAM,  line 334 of source/common/fpsxmlcommon.pas
  $00000000005A800B  READEMBEDDEDOBJS,  line 2809 of source/common/xlsxooxml.pas
  $00000000005AEB0B  READFROMSTREAM,  line 4565 of source/common/xlsxooxml.pas
  $000000000055C181  READFROMFILE,  line 589 of source/common/fpsreaderwriter.pas
  $0000000000499F16  READFROMFILE,  line 6579 of source/common/fpspreadsheet.pas
  $000000000049A442  READFROMFILE,  line 6646 of source/common/fpspreadsheet.pas
  $0000000000401A81  ReadExcelFileData,  line 93 of project1.lpr
  $00000000004014D8  DoRun,  line 57 of project1.lpr
  $0000000000483C99
.....

Very long list, I guess there is 288 identical blocks
.....
Call trace for block $00007FA7C93109B0 size 2048
  $000000000062E37A  CREATE,  line 2514 of laz2_dom.pas
  $0000000000620DF3  PROCESSXML,  line 1704 of laz2_xmlread.pas
  $000000000061E2F2  PARSE,  line 925 of laz2_xmlread.pas
  $000000000063B900  READXMLSTREAM,  line 334 of source/common/fpsxmlcommon.pas
  $00000000005A800B  READEMBEDDEDOBJS,  line 2809 of source/common/xlsxooxml.pas
  $00000000005AEB0B  READFROMSTREAM,  line 4565 of source/common/xlsxooxml.pas
  $000000000055C181  READFROMFILE,  line 589 of source/common/fpsreaderwriter.pas
  $0000000000499F16  READFROMFILE,  line 6579 of source/common/fpspreadsheet.pas
  $000000000049A442  READFROMFILE,  line 6646 of source/common/fpspreadsheet.pas
  $0000000000401A81  ReadExcelFileData,  line 93 of project1.lpr
  $00000000004014D8  DoRun,  line 57 of project1.lpr
  $0000000000483C99
  $F0F0F0F0F0F0F0F0
  $F0F0F0F0F0F0F0F0
  $F0F0F0F0F0F0F0F0
  $F0F0F0F0F0F0F0F0
Call trace for block $00007FA7B00F3500 size 32
  $000000000062E37A  CREATE,  line 2514 of laz2_dom.pas
  $0000000000620DF3  PROCESSXML,  line 1704 of laz2_xmlread.pas
  $000000000061E2F2  PARSE,  line 925 of laz2_xmlread.pas
  $000000000063B900  READXMLSTREAM,  line 334 of source/common/fpsxmlcommon.pas
  $00000000005A800B  READEMBEDDEDOBJS,  line 2809 of source/common/xlsxooxml.pas
  $00000000005AEB0B  READFROMSTREAM,  line 4565 of source/comm
--- End quote ---

On both Debain 11 + Lazarus 3.4 and Debian Testing + Lazarus 4.0 Rc1

(I just re-install FPSpreadSheet from online package manager, to check in case of version problem, and same results)

Cheers

TRon:
I am able to reproduce on bookworm with Lazarus 3.6, 4.0RC1, and trunk with fpc 3.2.3 (x86_64)

wp:
The same memory leak in the demo that I posted in my first response?

TRon:
Sorry, I (initially) missed your example wp. No leaks with your example (4.0RC1) only leaks with OP's example (with exact same trace as OP).

andresayang:

--- Quote from: TRon on December 09, 2024, 06:55:40 pm ---Sorry, I (initially) missed your example wp. No leaks with your example (4.0RC1) only leaks with OP's example (with exact same trace as OP).

--- End quote ---

Hi gents,

This is quite nice for me, thanks to confirm.
But if @wp do not have it, and we do, maybe something outside FPSPreadSheet (I was thinking about locals setup because it should be the only thing from system which could influence FPSpreadSheet).

So my locals are utf8 - us

Cheers

The thing is, in the example, if you keep only "SUMMARY" sheet in the workbook, no more memory leak. The function is supposed to read only "SUMMARY" sheet.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version