473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Strange MemoryLeak Issue

Airslash
221 100+
Hello,

I hope this falls under the correct topic...

We have a small application that uses the COM ports on a system to communicate with external devices. This application is written in Delphi and makes use of some third-party components.

We have around 500 identical systems, sort of speak, and there's only one location where this application is getting memoryleaks up to 500mb.
All other locations are running fine and don't suffer from this problem.

I'm more inclined to believe this to be a Windows problem on that system then a fault in the application. Anyone who can shed some insight on this, or experienced a similar issue?
Jul 29 '10 #1
15 1554
Jyoti Ballabh
115 100+
In most Delphi applications, where you use the components you drop on a form, you do not need to care to much about memory management. Once the component is placed on a form, the form becomes its owner and will free the memory taken by the component once the form is closed. Form, as the owner, is responsible for memory deallocation of the components it hosted. In short: components on a form are created and destroyed automatically. Now, when you need to use the TDeveloper class, you create an instance of the class by calling the Create method (constructor). The Create method allocates memory for a new object and returns a reference to the object.

var
zarko : TDeveloper
begin
zarko := TMyObject.Create;
zarko.DoProgram;
end;

This is a simple memory leak
Jul 29 '10 #2
Jyoti Ballabh
115 100+
Whenever you create an object, you must dispose the memory it occupied. To free the memory an object allocated, you must call the Free method. To be perfectly sure, you should also use the try / finally block:

var
zarko : TDeveloper
begin
zarko := TMyObject.Create;
try
zarko.DoProgram;
finally
zarko.Free;
end;
end;

This is an example of a safe memory allocation and deallocation code.

Warning: If you want to dynamically instantiate a Delphi component and explicitly free it sometime later, always pass nil as the owner. Failure to do so can introduce unnecessary risk, as well as performance and code maintenance problems.
Jul 29 '10 #3
Airslash
221 100+
I know what might cause a memory leak in Delphi.
I'm more interested as to why the memory leak only occurs on one specific system and not the 245 other systems we have running.

And they're all running the same OS, have the same hardware and run the same version of the software written.
Jul 29 '10 #4
Jyoti Ballabh
115 100+
I'll get back to you later on this one. An isolated instance of system memory leak. I can think of either malware of defect in Assembly Coding. I have never encountered or tackled this problem before.
Jul 29 '10 #5
Airslash
221 100+
aye,

it's a first one for me as well.
Normally if it's a coding memoryleak I expect it to appear in all the applications on all the systems, but it's really just this one.
Jul 29 '10 #6
Jyoti Ballabh
115 100+
that's what got me thinking, if it's a coding error or let's say something to do with the OS, the problem should persist in all the systems; why just one? I will have to rule out any mechanical damage or should I?
Jul 29 '10 #7
Airslash
221 100+
I doubt mechanical damage to the components would be the cause. I'd expect the application or even the system to simply crash if the memory got damaged.

Any suggestions on a good diagnostics tool to check RAM and system performance?
Jul 29 '10 #8
Jyoti Ballabh
115 100+
I don't know, I do it the old fashioned way if I have to. Run through the Windows memory diagnostic executable file, mtinst.exe...... i can give you the details on this one if you want.
Jul 29 '10 #9
Jyoti Ballabh
115 100+
For some hardware configurations, Windows Memory Diagnostic can identify the specific failing memory component. If Windows Memory Diagnostic can successfully isolate all the errors detected to one or more corresponding memory modules, the View errors by memory module option will be available in the menu. You can use this option to determine which specific memory modules are failing and need to be removed or replaced. This could be one of the causes of the memory leaks. I am not entirely sure, though.
Jul 29 '10 #10
Airslash
221 100+
I'll take a look at it.
Jul 29 '10 #11
Oralloy
985 Expert 512MB
Just as an observation, the easiest fix might be to re-build the failing system.

Either re-install your stock image (assuming you have one), or start with a Windoze disk and re-install all the necessary software.
Jul 29 '10 #12
Airslash
221 100+
not an option i'm afraid.
This is a live production system at the client and cannot be simply taken down.
Jul 29 '10 #13
Oralloy
985 Expert 512MB
Unfortunate. It's probably cost everyone more time to "fix" the problem at this point than a rebuild will take.

Sorry, I've been caught where you are, too. There are no pretty answers.

Please let us know what the resolution is, when you find it.

Good Luck!
Jul 29 '10 #14
Airslash
221 100+
will definitly keep you updated on our "adventure".

Tommorow we're spitting through all the log files we have been generating from perfmon and see if we can find anything.
Jul 29 '10 #15
Jyoti Ballabh
115 100+
yea, I am pretty sure that the only reason why this is happening is due to the run time error in one of the executable files. Run the WDEF for the system and see what sort of message do you get.
Jul 30 '10 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: J P Singh | last post by:
Hi All I am storing the currency used field in one my table and the values stored are as below £ $ ? etc etc
9
by: Robert Misiorowski | last post by:
Hello, I have a very perplexing (at least to me) problem that hopefully someone can help me with. I'm making a site with a 3 column layout. In the middle column (my fluid column) I am trying to...
0
by: WC Justice | last post by:
This website is running on IIS 6, SQL Server 7 back end, asp scripting. It has public and private areas, but uses the same connection scripting throughout the entire site. SET conn =...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
2
by: Tariq Ahmad | last post by:
hi, i am having big issues in deploying my asp.net web application to our web server. dates do not behave the same as on my development machine yet the web.config files are the same and both...
1
by: Torfi | last post by:
Hello all I've got a very weird situation I need help with. I'm building a solution where I have custom components in a web content management system using a web store library (API in DLLs). The...
4
prometheuzz
by: prometheuzz | last post by:
Hello all, There's this problem I have, which I am unable to find a solution for. The problem is this: I cannot post messages with a specific size on (certain) forums. I hear you thinking: what...
4
by: Mr.SpOOn | last post by:
Hi, I'm trying the nose testing package. I've just started reading the tutorial and I had a problem with the first simple example. This is the test: def test_b(): assert 'b' == 'b' In the...
1
by: chris3vic | last post by:
I have a dynamically created datagrid, populated from a dataset that is filled by a sql string triggered by a command button. The application itself allows a user to input a selection of criteria and...
3
by: ziycon | last post by:
I'm having an issue with my AJAX function, its been working fine then I added another link, and now when i click on an AJAX link on the menu, it tries to load the correct page for a split second and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.