Forum > Packages and Libraries

[SOLVED] FPSpreadSheet, ReadAsText seems to create Memory leak

(1/4) > >>

andresayang:
Hello,

I eliminate instructions one by one ... TsWorksheet.ReadAsText seems to produce Memory leaks when reading workbook containing more than one spreadsheet.
I can give The excel book, and the code i wrote, If you please can help me ...

Thanks

wp:
Please show your code and the Excel file. A memory leak does not happen - see attached project which creates a workbook with two sheets containing random numbers, writes it to an xlsx file and reads it back; heaptrc reports "0 unfreed memory blocks : 0".

andresayang:
Hi,

Many thanks for having a look at it.
I'll post code and the "problematic" excel sheet tomorrow (Brazil time).

The thing is when I do remove "extra sheet" (the one I do not have data to read), no more memory leeks. (and right now I have only the "clean" version without leaks).

Cheers

andresayang:
Hi,

So i make a new project to reduce the code, with the function i use to read excel file which gives Memory leaks.
All included in "7zip" file, I remove executable, you only have sources.

Thanks for your help,

Cheers

You will notice I'm using linux, hope it doesn't change nothing

wp:
Tested your project in both Windows 11 and Manjaro Linux. In each case, there is *no* error leak. Maybe you are confused by the non-empty heaptrc output, saying

--- Code: ---Heap dump by heaptrc unit of D:\Prog_Lazarus\tests\_fpspreadsheet\_forum\test_memleak\TestMemLeaks\project1.exe
1423598 memory blocks allocated : 136386984/138556552
1423598 memory blocks freed     : 136386984/138556552
0 unfreed memory blocks : 0
True heap size : 2523136 (144 used in System startup)
True free heap : 2522992
--- End code ---
The relevant line is the one with "0 unfreed memory block: 0" meaning that there are no unfreed memory blocks.

Navigation

[0] Message Index

[#] Next page

Go to full version