[SOLVED]Memory leak when using HTML tags, FpSpreadsheet 2.0 lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- Russ · 2025-09-16 12:18 I have an application which uses a TsWorkbookTabControl with a TsWorkseetGrid and a TsWorkbookSource. Extensive use is made HTML tags for text formatting. I have noticed that simply clicking on a cell that uses such formatting results in a memory leak. This was traced to unit fpsHTMLUtils, function TsHTMLComposer.Exec(), line 1060 where prevFnt is created but never released. Enclosing the rest of the function in a Try-Finally where prevFnt is freed solves the problem. The patch is attached. I tried to make a simple example app to illustrate the problem, but even though I used HTML tags, TsHTMLComposer.Exec() never gets called. I even tried testing with the fpsgrids example app, which uses rich text, and again TsHTMLComposer.Exec() never gets called, so I have no idea why there is different behavior with my code. ---------------------------------------------------------------------- wp · 2025-09-16 18:26 Thanks for reporting. Applied your patch. Here is a small test project to demonstrate the issue before and its solution after applying the patch (requires "Use Heaptrc unit" in project options): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1;uses  SysUtils, fpSpreadsheet, fpsTypes, xlsxOOXML, fpsHTMLUtils;var  wbook: TsWorkbook;  wsheet: TsWorksheet;  cell: PCell;  s: String;begin  wbook := TsWorkbook.create;  try    wsheet := wbook.AddWorksheet('Page');    cell := wsheet.WriteTextAsHTML(0, 0, 'bold italic normal');    RichTextToHTML(wbook, wsheet.ReadCellFont(cell),      cell^.UTF8StringValue, cell^.RichTextParams, s);    WriteLn(s);//    wbook.WriteToFile('rtf- cell.xlsx', true);  finally    wbook.Free;  end;end.