Memory Leak

Questions and answers on how to use DOCXReadWrite
Post Reply
dkjMusic
Posts: 1
Joined: Thu May 30, 2019 7:54 pm

Memory Leak

Post by dkjMusic »

I have TDOCXReadWriteVcl and TAXWPreviewVcl components on Delphi form. I use DOCXReadWriteVcl.LoadFromFile(ProjectRF) to load an existing .docx document and everything looks fine.

In the FormClose I have DOCXReadWriteVcl.Free; AXWPreviewVcl.Free; and Action := caFree;

But when I close the app (it has ReportMemoryLeaksOnShutdown := True;), I get the following memory leak:

---------------------------
Unexpected Memory Leak
---------------------------
An unexpected memory leak has occurred. The unexpected small block leaks are:
21 - 28 bytes: TMBCSEncoding x 1

What do I need to close the leak?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Memory Leak

Post by larsa »

Hello

I have also noticed this, but I have no idea why it happeneds. No TMBCSEncoding is created and the construct of TMBCSEncoding is never called. Delphi bug?
Lars Arvidsson, Axolot Data
oz_
Posts: 5
Joined: Tue Dec 15, 2020 8:04 am

Re: Memory Leak

Post by oz_ »

Hi, this leak happens too over here.

This is the callstack, maybe it helps to find the issue. I'm compiling directly from sources by the way.

King regards,
Orest.

Code: Select all

A memory block has been leaked. The size is: 36

This block was allocated by thread 0x42EC, and the stack trace (return addresses) at the time was:
40787E [System.pas][System][@GetMem$qqri][4791]
40AD97 [System.pas][System][TObject.NewInstance][17386]
40B532 [System.pas][System][@ClassCreate$qqrpvzc][18765]
441962 [System.SysUtils.pas][System.SysUtils][Sysutils.TMBCSEncoding.Create][33284]
8459336 [GetRawStackTrace]
772F166C [ZwReadFile]
4415FC [System.SysUtils.pas][System.SysUtils][Sysutils.TEncoding.GetEncoding][33124]
1CB1727 [System.Zip.pas][System.Zip][GetCP437Encoding][582]
1CB1750 [System.Zip.pas][System.Zip][Zip.TZipFile.GetEncoding][594]
1CB4B13 [System.Zip.pas][System.Zip][Zip.TZipFile.GetTextEncode][1415]
1CB50ED [System.Zip.pas][System.Zip][Zip.TZipFile.IndexOf][1535]
8459336 [GetRawStackTrace]
8459336 [GetRawStackTrace]
1CCD8AC [AXWReadWriteZIP5.pas][AXWReadWriteZIP5][TXLSZipArchiveIntfDelphi.Find][357]
1CCD92F [AXWReadWriteZIP5.pas][AXWReadWriteZIP5][TXLSZipArchiveIntfDelphi.OpenStream][370]
40B5A0 [System.pas][System][@AfterConstruction$qqrxp14System.TObject][18814]
1E01C32 [xpgAXWParseContentType.pas][xpgAXWParseContentType][TXPGDocContentType.Create][712]
1E05BCE [AXWReadWriteOPC5.pas][AXWReadWriteOPC5][TOPCContainer.ReadContentTypes][1111]
1E05A6F [AXWReadWriteOPC5.pas][AXWReadWriteOPC5][TOPCContainer.OpenRead][1070]
1E08E2D [AXWReadWriteOPC5.pas][AXWReadWriteOPC5][TOPC_DOCX.OpenRead][2199]
1E0AD8C [AXWDocxManager.pas][AXWDocxManager][TDocxManager.LoadFromStream][300]
1E1C152 [AXWReadDOCX.pas][AXWReadDOCX][TAXWReadDOCX.LoadFromStream][2839]
1E80859 [DOCXReadWriteVcl.pas][DOCXReadWriteVcl][TDOCXReadWrite.LoadFromStream][240]
1E80618 [DOCXReadWriteVcl.pas][DOCXReadWriteVcl][TDOCXReadWrite.GetFiletype][202]
1E8074A [DOCXReadWriteVcl.pas][DOCXReadWriteVcl][TDOCXReadWrite.LoadFromFile][213]
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Memory Leak

Post by larsa »

Hello

As you can see from the dump, everything is happening in the delphi system units. Nothing to do.
Lars Arvidsson, Axolot Data
Post Reply