ThN
ThN

Reputation: 3276

Delphi 7.0 and memory leak?

After spending time with FastMM4 in weeding out any pieces of code that could possibly cause memory leak as indicated by FastMM4, we have been test running our software for about a month non-stop on Windows 7. This is what I am seeing so far in the Task Manager for my software process.

> -CPU started out at 1% and 0%. Now it is bouncing around from 2% to 5%
> -VM usage started out at 11,852KB. Now it is at 4,900kb but bouncing
> around from 4,900kb to 5,000kb.

Does this mean we have memory leak in our software? I am confused and concerned.

Thanks in advance,

Upvotes: 4

Views: 581

Answers (4)

MastAvalons
MastAvalons

Reputation: 1141

May be worth to think about the debugger? I've understood that you do not use them. I also had problems with memory leaks. I just had no guessed about it. Now use the "guardian" of the leaks - for me it became deleaker. And you can look such one, that will please you.

Upvotes: 1

mjn
mjn

Reputation: 36664

Even if an application seems to run fine for days, there still can be memory leaks hidden in code areas which are not (or not frequently) used. So they can be a problem, when this part of the application becomes active some time later.

To make sure that all code is tested for leaks, you can use FastMM4 with unit tests (with DUnit), ensuring to execute as many code paths as possible. Unit test code coverage can be measured for example with this open source Delphi tool, or Discover which recently became open source.

Also, DUnit in the trunk version (9.4.0) supports automatic memory leak detection (based on FastMM4) for every test case.

Upvotes: 3

Mason Wheeler
Mason Wheeler

Reputation: 84650

That sounds like pretty normal memory usage. The program does something that needs memory, and memory usage goes up. The program gets done with what it's doing and releases the memory, and memory usage goes back down. A memory leak is when memory usage goes up and keeps going up because you're not releasing the memory once you're done with it.

If you've got FastMM4, you shouldn't have to hunt around for things that might possibly cause a memory leak. Just turn on Full Debug Mode and the logging option and it will find any memory that leaks when you run it, and write out a file with types and stack traces for you.

Upvotes: 4

Harriv
Harriv

Reputation: 6137

No, when memory usage goes up and eventually your application uses all available memory, you have memory leak and reason to be concerned.

Upvotes: 4

Related Questions