Delphi 7.0 and memory leak?

After spending time with FastMM4 sifting out any code fragments that could cause a memory leak, as indicated in FastMM4, we tested our software for a month without stopping in Windows 7. This is what I still see 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 that we have a memory leak in our software? I am confused and worried.

Thanks in advance,

+4
source share
4 answers

This seems like a pretty normal memory usage. The program does what requires memory, and memory usage is increasing. The program runs with what it does and frees memory, and memory usage is returned. A memory leak is when memory usage grows and continues to grow, because you do not free memory when you are done with it.

If you have FastMM4, you will not need to look for things that could cause a memory leak. Just turn on the full debugging mode and the logging option, and it will find any memory that leaks when it starts, and write out a file with the type and stack for you.

+4
source

No, when memory usage increases, and ultimately your application uses all available memory, you have a memory leak and a reason to worry about.

+4
source

Even if the application works fine for several days, there may still be memory leaks hidden in areas of the code that are not used (or not often). Thus, this can be a problem when this part of the application is activated after some time.

To ensure that all code is tested for leaks, you can use FastMM4 with unit tests (with DUnit ), ensuring that as many code paths as possible are executed. Unit test code coverage can be measured, for example, using the open source Delphi or Open , which has recently become open source .

In addition, DUnit in version trunk (9.4.0) supports automatic memory leak detection (based on FastMM4) for each test case.

+3
source

Maybe you should think about a debugger? I realized that you are not using them. I also had problems with memory leaks. I just had no idea about it. Now use the leak keeper - for me it has become a deleteaker. And you can see one that you like.

+1
source

Source: https://habr.com/ru/post/1348123/


All Articles