ViaThinkSoft CodeLib
This article is in:
CodeLib → Programming aids → Delphi
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.
Following change will fix the issue:
Any additional member to the record will fix the issue.
Tested with Delphi 2007 Professional.
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 Co-Founder
ViaThinkSoft Co-Founder