Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/RTL Exceptions
[ Add a report in this area ]
Report #:
101329
Status:
Open
Exception.StackInfo leaks if AcquireExceptionObject is used
Project:
Delphi
Build #:
16.0.4316.44803
Version:
16.2
Submitted By:
Andreas Hausladen
Report Type:
Minor failure / Design problem
Date Reported:
11/25/2011 1:37:19 PM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
288975
Resolution:
None
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
Exceptions leak memory for the StackInfo if an stack info provider is installed (Exception.GetExceptionStackInfoProc) and the AcquireExceptionObject function is used. This is because the GetExceptionStackInfoProc is called when the exception is raised. But if the exception is raised again after a call to AcquireExceptionObject, the StackInfo field is overwritten and the value from the previous call to GetExceptionStackInfoProc is lost.
A possible fix is to skip the call to GetExceptionStackInfoProc if the StackInfo field already has a value.
This bug exists since the StackInfo was introduced.
Steps to Reproduce:
1. Open the attached project in XE2
2. Start it
Expected:
No memory leak is reported.
Actual:
It outputs "Memory leaked" and the memory manager shows the memory leak report for the string that was allocated in GetExceptionStackInfo
Workarounds
Return the already allocated StackInfo if the ExceptionRecord.ExceptObject.StackInfo is not nil.
function GetExceptionStackInfo(P: PExceptionRecord): Pointer;
begin
if (P.ExceptObject <> nil) and (Exception(P.ExceptObject).StackInfo <> nil) then
Result := Exception(P.ExceptObject).StackInfo
else
Result := AllocateStackInfo...;
end;
Attachment
ExceptionStackInfoMemLeak.zip
Comments
None
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us