Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to find Memory Leaks in Delphi5????????? Posted by Chaitanya_Pune on 29 Mar 2006 at 3:49 AM
Hi,
You all might know that we can easily find out which source code line has generated run time Access Violation using {$D+} directive and Search -> Find Error option.
I would like to know whether any such easy way exists for finding memory leaks in Delphi5 or not? If so please let me know the detailed description.

Bye.
Report
Re: How to find Memory Leaks in Delphi5????????? Posted by zibadian on 29 Mar 2006 at 4:12 AM
: Hi,
: You all might know that we can easily find out which source code line has generated run time Access Violation using {$D+} directive and Search -> Find Error option.
: I would like to know whether any such easy way exists for finding memory leaks in Delphi5 or not? If so please let me know the detailed description.
:
: Bye.
:
There is one known memory leak in all programs using the VCL. This leak is located in the message to event conversion code, specifically in the message stub. Since this code is directly inaccessable by the programmer, you need search for it. Reference: Roy Nelson, "Memory Lost And Found... And Released", The Delphi Magazine Issue 75 (November 2001).
Other memory leaks can be prevented by correctly freeing resources and protecting code blocks with try...finally blocks. Since code can have many ways of allocating memory blocks, there are many ways of "creating" memory leaks. Since the compiler lacks the intelligence to assess all those ways, there is no way to find all memory leaks automatically. The only way to check for leaks is to do it manually.
Report
Re: How to find Memory Leaks in Delphi5????????? Posted by jobromedia on 3 Apr 2006 at 6:42 AM
: Since the compiler lacks the intelligence to assess all those ways, there is no way to find all memory leaks automatically. The only way to check for leaks is to do it manually.
:
Ok how do I do that?
Report
Re: How to find Memory Leaks in Delphi5????????? Posted by zibadian on 3 Apr 2006 at 7:21 AM
: : Since the compiler lacks the intelligence to assess all those ways, there is no way to find all memory leaks automatically. The only way to check for leaks is to do it manually.
: :
: Ok how do I do that?
:
Run the program while the task manager is visible. In the task manager you can see the memory it uses, the memory should remain more or less constant. If you find that the memory steadily increases then there is a leak. You then should examine your code to see where the leak is. Leaks are usually memory block which are allocated but not deallocated.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.