View Issue Details

IDProjectCategoryView StatusLast Update
0036240FPCPackagespublic2019-11-02 11:34
ReporterGrzegorz IlczukAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.4Product Build 
Target VersionFixed in Version3.3.1 
Summary0036240: BigEndianUnicode produces memory leaks
DescriptionUsing BigEndianUnicode in a code:

var
Bytes:TBytes;
s: string;

begin
SetLength(Bytes, 28);

Bytes[00]:=$00;
  Bytes[01]:=$42;
  Bytes[02]:=$00;
  Bytes[03]:=$6C;
  Bytes[04]:=$00;
  Bytes[05]:=$61;
  Bytes[06]:=$00;
  Bytes[07]:=$68;
  Bytes[08]:=$00;
  Bytes[09]:=$20;
  Bytes[10]:=$00;
  Bytes[11]:=$42;
  Bytes[12]:=$00;
  Bytes[13]:=$6C;
  Bytes[14]:=$00;
  Bytes[15]:=$61;
  Bytes[16]:=$00;
  Bytes[17]:=$68;
  Bytes[18]:=$00;
  Bytes[19]:=$20;
  Bytes[20]:=$00;
  Bytes[21]:=$42;
  Bytes[22]:=$00;
  Bytes[23]:=$6C;
  Bytes[24]:=$00;
  Bytes[25]:=$61;
  Bytes[26]:=$00;
  Bytes[27]:=$00;

s:=TEncoding.BigEndianUnicode.GetString(Bytes);

produces memory leaks. The same steps are OK if using TEncoding.Unicode.GetString(Bytes);
Steps To ReproduceJust copy the part of the code from the description and try to run it.

I have used the latest Lazarus 2.0.4 version for it (Linux 64-bit, gtk2), FPC v. 3.0.4
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

Michael Van Canneyt

2019-11-02 11:34

administrator   ~0118972

Following program in trunk produces no memleaks in trunk, but produces one in 3.0.4.
I suspect this was fixed with a related bugreport.

program tenc;

uses sysutils;

procedure dotest;

var
  Bytes:TBytes;
  s: string;

begin
  SetLength(Bytes, 28);

  Bytes[00]:=$00;
  Bytes[01]:=$42;
  Bytes[02]:=$00;
  Bytes[03]:=$6C;
  Bytes[04]:=$00;
  Bytes[05]:=$61;
  Bytes[06]:=$00;
  Bytes[07]:=$68;
  Bytes[08]:=$00;
  Bytes[09]:=$20;
  Bytes[10]:=$00;
  Bytes[11]:=$42;
  Bytes[12]:=$00;
  Bytes[13]:=$6C;
  Bytes[14]:=$00;
  Bytes[15]:=$61;
  Bytes[16]:=$00;
  Bytes[17]:=$68;
  Bytes[18]:=$00;
  Bytes[19]:=$20;
  Bytes[20]:=$00;
  Bytes[21]:=$42;
  Bytes[22]:=$00;
  Bytes[23]:=$6C;
  Bytes[24]:=$00;
  Bytes[25]:=$61;
  Bytes[26]:=$00;
  Bytes[27]:=$00;
  s:=TEncoding.BigEndianUnicode.GetString(Bytes);
end;

begin
  dotest;
end.

Issue History

Date Modified Username Field Change
2019-11-01 12:55 Grzegorz Ilczuk New Issue
2019-11-02 11:34 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-11-02 11:34 Michael Van Canneyt Status new => resolved
2019-11-02 11:34 Michael Van Canneyt Resolution open => fixed
2019-11-02 11:34 Michael Van Canneyt Fixed in Version => 3.3.1
2019-11-02 11:34 Michael Van Canneyt FPCTarget => 3.2.0
2019-11-02 11:34 Michael Van Canneyt Note Added: 0118972