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/Thread support
[ Add a report in this area ]
Report #:
67691
Status:
Closed
BeginThread memory leak
Project:
Delphi
Build #:
12.0.3155.16733
Version:
12.0
Submitted By:
Alexey Kazantsev
Report Type:
Minor failure / Design problem
Date Reported:
10/8/2008 9:13:54 PM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
266121
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
15.0.3573.25335
Duplicate of:
None
Voting and Rating
Overall Rating:
(1 Total Rating)
4.00 out of 5
Total Votes:
None
Description
If BeginThread cannot create a new thread (any reason) occures memory leak.
Steps to Reproduce:
function BeginThread(SecurityAttributes: Pointer; StackSize: LongWord;
ThreadFunc: TThreadFunc; Parameter: Pointer; CreationFlags: LongWord;
var ThreadId: LongWord): Integer;
var
P: PThreadRec;
begin
if Assigned(SystemThreadFuncProc) then
P := PThreadRec(SystemThreadFuncProc(ThreadFunc, Parameter))
else
begin
New(P);
P.Func := ThreadFunc;
P.Parameter := Parameter;
end;
IsMultiThread := TRUE;
Result := CreateThread(SecurityAttributes, StackSize, @ThreadWrapper, P,
CreationFlags, ThreadID);
end;
Variable P : PThreadRec allocated in BeginThread release in ThreadWrapper which not executed if BeginThread not successful.
Workarounds
None
Attachment
None
Comments
Lucian Radulescu at 10/12/2008 7:57:29 PM
-
What "any reason"? if Createthread fails, your application is doomed anyway, who cares about a few bytes memory leak :-)
Alexey Kazantsev at 10/13/2008 2:28:25 AM
-
No. This may be thread from thread pool. I have situation, when BeginThread fails, but this no kill my application.
Lucian Radulescu at 1/20/2009 1:39:30 PM
-
>This may be thread from thread pool
So what ... again, if the system can not create threads your application is doomed anyway :-)
Alexey Kazantsev at 2/1/2009 3:57:02 PM
-
Not. Pool can have various count of threads.
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