Go to English page

ViaThinkSoft CodeLib

Dieser Artikel befindet sich in der Kategorie:
CodeLibProgrammierhilfenDelphi

The following record will cause memory corruptions (can be detected with FastMM4) because the reference counting of the string inside the record is not correctly handled anymore.

type
  TBuggy = record
    MyString: string;
  end;

Following change will fix the issue:

type
  TWorking = record
    Dummy: Cardinal;
    MyString: string;
  end;

Any additional member to the record will fix the issue.

Tested with Delphi 2007 Professional.
Daniel Marschall
ViaThinkSoft Mitbegründer