Memory Leak with GetEncoding

Giganews Newsgroups
Subject: Memory Leak with GetEncoding
Posted by:  Christian Kaufmann (christian.kaufma…@gmx.net)
Date: Tue, 13 Jul 2010

Hi,

I noticed a memory leak with the latest Indy source:

--------------------------------2010/7/13
16:29:08--------------------------------
A memory block has been leaked. The size is: 36

This block was allocated by thread 0x990, and the stack trace (return
addresses) at the time was:
404736 [System.pas][System][System.@GetMem][2979]
405BDB [System.pas][System][System.TObject.NewInstance][9433]
4061A6 [System.pas][System][System.@ClassCreate][10277]
4739DA [SysUtils.pas][SysUtils][SysUtils.TMBCSEncoding.Create][22434]
9DE8D0 [IdCharsets.pas][IdCharsets][IdCharsets.FindCharset][3888]
473806 [SysUtils.pas][SysUtils][SysUtils.TEncoding.GetEncoding][22360]
9F3A70
[IdGlobalProtocols.pas][IdGlobalProtocols][IdGlobalProtocols.CharsetToEncoding][4199]

The problem is TEncoding.GetEncoding, which creates a new object, that
has to be freed by the calling method.

Or should I do that, when calling CharsetToEncoding() ?

cu Christian

Replies