Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread D2006 & FastMM
Fri, Mar 24 2006 9:00 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

This may be useful

Some information about the new memory manager for dephi 2006, posted in the newgroups by Pierre le Riche. It is useful information and it cannot be found in the help.

You have to set the global variable "ReportMemoryLeaksOnShutdown" to true if
you want it to check for leaks on shutdown. I typically use:

 {Display leaks on shutdown if a debugger is present}
 ReportMemoryLeaksOnShutdown := DebugHook <> 0;

This only shows the leak report if the application is run inside the Delphi
debugger.



Roy Lambert
Fri, Mar 24 2006 9:18 AMPermanent Link

Sean McCall
Good tip!

Thanks for sharing,

Sean

Roy Lambert wrote:
> This may be useful
>
> Some information about the new memory manager for dephi 2006, posted in the newgroups by Pierre le Riche. It is useful information and it cannot be found in the help.
>
> You have to set the global variable "ReportMemoryLeaksOnShutdown" to true if
> you want it to check for leaks on shutdown. I typically use:
>
>   {Display leaks on shutdown if a debugger is present}
>   ReportMemoryLeaksOnShutdown := DebugHook <> 0;
>
> This only shows the leak report if the application is run inside the Delphi
> debugger.
>
>
>
> Roy Lambert
Fri, Mar 24 2006 12:21 PMPermanent Link

Jon Lloyd Duerdoth
Roy,

thanks for the tip.

I now find just starting up and exiting from my app gives
2 small memory leaks:
1-12 bytes    TIDThreadSafe integer x 1
21-28 bytes   TIdCriticalSection x 2

Any idea what that means?

Jon

Roy Lambert wrote:
> This may be useful
>
> Some information about the new memory manager for dephi 2006, posted in the newgroups by Pierre le Riche. It is useful information and it cannot be found in the help.
>
> You have to set the global variable "ReportMemoryLeaksOnShutdown" to true if
> you want it to check for leaks on shutdown. I typically use:
>
>   {Display leaks on shutdown if a debugger is present}
>   ReportMemoryLeaksOnShutdown := DebugHook <> 0;
>
> This only shows the leak report if the application is run inside the Delphi
> debugger.
>
>
>
> Roy Lambert
Fri, Mar 24 2006 4:11 PMPermanent Link

Michael Baytalsky

> Any idea what that means?
Means, you're using Indy Wink.

Michael

>
> Roy Lambert wrote:
>> This may be useful
>>
>> Some information about the new memory manager for dephi 2006, posted
>> in the newgroups by Pierre le Riche. It is useful information and it
>> cannot be found in the help.
>>
>> You have to set the global variable "ReportMemoryLeaksOnShutdown" to
>> true if you want it to check for leaks on shutdown. I typically use:
>>
>>   {Display leaks on shutdown if a debugger is present}
>>   ReportMemoryLeaksOnShutdown := DebugHook <> 0;
>>
>> This only shows the leak report if the application is run inside the
>> Delphi debugger.
>>
>>
>>
>> Roy Lambert
Fri, Mar 24 2006 8:28 PMPermanent Link

Jon Lloyd Duerdoth
Michael,

> Means, you're using Indy Wink.
Not explicitly...
besides, I have unselected all Indy components so maybe it's
something else?

Jon


Michael Baytalsky wrote:
>
>> Any idea what that means?
> Means, you're using Indy Wink.
>
> Michael
>
>>
>> Roy Lambert wrote:
>>> This may be useful
>>>
>>> Some information about the new memory manager for dephi 2006, posted
>>> in the newgroups by Pierre le Riche. It is useful information and it
>>> cannot be found in the help.
>>>
>>> You have to set the global variable "ReportMemoryLeaksOnShutdown" to
>>> true if you want it to check for leaks on shutdown. I typically use:
>>>
>>>   {Display leaks on shutdown if a debugger is present}
>>>   ReportMemoryLeaksOnShutdown := DebugHook <> 0;
>>>
>>> This only shows the leak report if the application is run inside the
>>> Delphi debugger.
>>>
>>>
>>>
>>> Roy Lambert
Sat, Mar 25 2006 2:59 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jon


Not 100%. As Michael says it looks like Indy (the id bit) so it might be you're using something that calls Indy (btw I haven't even installed it - I use Synapse). Its great that FastMM tells you there's a leak but wouldn't it be wonderful if it threw out the component name / line number instantiated.

It may even be that these are "expected" leaks. Delphi does have some and I know there's a way to say "stop telling me about them" but I'm not sure how.

All I can suggest is to search your code for any instances of these two and make sure they're freed. If its a Delphi thing just ignore. What I did with my beloved D6 was to run and empty project (just a form) and note the errors and then ignore for the future.

Roy Lambert
Sat, Mar 25 2006 7:30 AMPermanent Link

Michael Baytalsky

Intraweb? I had memory leaks of this kind with Intraweb,
but you said application, so I didn't suggest Intraweb.

'Id' is *defnitely* Indy, so you're using them whether you
like it or not (see IdThreadSafe.pas in Indy folder in Source) Wink

Michael

Jon Lloyd Duerdoth wrote:
> Michael,
>
>  > Means, you're using Indy Wink.
> Not explicitly...
> besides, I have unselected all Indy components so maybe it's
> something else?
>
> Jon
>
>
> Michael Baytalsky wrote:
>>
>>> Any idea what that means?
>> Means, you're using Indy Wink.
>>
>> Michael
>>
>>>
>>> Roy Lambert wrote:
>>>> This may be useful
>>>>
>>>> Some information about the new memory manager for dephi 2006, posted
>>>> in the newgroups by Pierre le Riche. It is useful information and it
>>>> cannot be found in the help.
>>>>
>>>> You have to set the global variable "ReportMemoryLeaksOnShutdown" to
>>>> true if you want it to check for leaks on shutdown. I typically use:
>>>>
>>>>   {Display leaks on shutdown if a debugger is present}
>>>>   ReportMemoryLeaksOnShutdown := DebugHook <> 0;
>>>>
>>>> This only shows the leak report if the application is run inside the
>>>> Delphi debugger.
>>>>
>>>>
>>>>
>>>> Roy Lambert
Sat, Mar 25 2006 9:05 AMPermanent Link

Jon Lloyd Duerdoth
Michael,

IndyMail related to ReportBuilder &/or the ExtraDevices addon.

Thanks for the pointers.

   Jon

Michael Baytalsky wrote:
>
> Intraweb? I had memory leaks of this kind with Intraweb,
> but you said application, so I didn't suggest Intraweb.
>
> 'Id' is *defnitely* Indy, so you're using them whether you
> like it or not (see IdThreadSafe.pas in Indy folder in Source) Wink
>
> Michael
>
> Jon Lloyd Duerdoth wrote:
>> Michael,
>>
>>  > Means, you're using Indy Wink.
>> Not explicitly...
>> besides, I have unselected all Indy components so maybe it's
>> something else?
>>
>> Jon
>>
>>
>> Michael Baytalsky wrote:
>>>
>>>> Any idea what that means?
>>> Means, you're using Indy Wink.
>>>
>>> Michael
>>>
>>>>
>>>> Roy Lambert wrote:
>>>>> This may be useful
>>>>>
>>>>> Some information about the new memory manager for dephi 2006,
>>>>> posted in the newgroups by Pierre le Riche. It is useful
>>>>> information and it cannot be found in the help.
>>>>>
>>>>> You have to set the global variable "ReportMemoryLeaksOnShutdown"
>>>>> to true if you want it to check for leaks on shutdown. I typically
>>>>> use:
>>>>>
>>>>>   {Display leaks on shutdown if a debugger is present}
>>>>>   ReportMemoryLeaksOnShutdown := DebugHook <> 0;
>>>>>
>>>>> This only shows the leak report if the application is run inside
>>>>> the Delphi debugger.
>>>>>
>>>>>
>>>>>
>>>>> Roy Lambert
Wed, Mar 29 2006 11:26 AMPermanent Link

"John Seward"
> Its great that FastMM tells you there's a leak but wouldn't it be
> wonderful if it threw out the component name / line number
> instantiated.

Roy,

It already does something pretty close to that. If you set the linker
to "Include TD32 debug info"  (Project Options / Linker / EXE and DLL
options), the dump into the AppName_MemoryManager_EventLog.txt file
(when in FullDebugMode) includes the address and method/routine names
in the stack trace of when the block was allocated.

Of course, setting that linker option can dramatically increase the
size of large projects, and slow down the compiler output a bit... but
it's easy to turn on and off.
Wed, Mar 29 2006 11:32 AMPermanent Link

"John Seward"
Roy,

Here's a portion from a sample dump from code that just does a
GetMem(p, 10000) in an otherwise empty project's main form OnCreate:


--------------------------------2006/3/29
11:25:45--------------------------------
A memory block has been leaked. The size is: 10180

Stack trace of when this block was allocated (return addresses):
402962 [System][@GetMem]
4420BE [Unit1.pas][Unit1][TForm1.FormCreate]
439E5F [Forms][TCustomForm.DoCreate]
439B5B [Forms][TCustomForm.AfterConstruction]
403292 [System][@AfterConstruction]
439B31 [Forms][TCustomForm.Create]
77F6BDF6 [LdrGetProcedureAddress]
77F6BEAC [LdrGetProcedureAddress]
40C08E [SysUtils][FormatBuf]

The block is currently used for an object of class: Unknown

.... ... ...

This application has leaked memory. The sizes of leaked medium and
large blocks are (excluding expected leaks registered by pointer): 10180

Note: Memory leak detail is logged to a text file in the same folder as
this application. To disable this memory leak check, undefine
"EnableMemoryLeakReporting".
Page 1 of 2Next Page »
Jump to Page:  1 2
Image