Jump to content
limelect

Leak problem

Recommended Posts

Are you using TIdHttpServer? (In the other topic you showed some code with just TIdHTTP)

 

How do you measure the leak? with just FastMM4 or MadExcept?

The topic you linked to mentioned FastMM doesn't report the leak but MadExcept does.

So how is this problem the same as mentioned in that topic?

 

What exactly is your leak, how does it show and what (minimal) code can you provide which reproduces this?

 

Share this post


Link to post

@rvk The leak is exactly in the first link Using fastmm4

A solution is on the second

Edited by limelect

Share this post


Link to post
4 hours ago, limelect said:

And? The problem is ...?

4 hours ago, limelect said:

Tried this suggestion

https://www.viathinksoft.com/codelib/144 on create

Wow, that is a really dirty and ugly hack.  That code is reading the machine instructions of TIdStack.DecUsage() at runtime trying to find where it accesses the global GStackCriticalSection variable, and then it dereferences that variable to get the address of the TIdCriticalSection object, and then register it with FastMM so it won't appear in leak reports.  I don't see why that hack is necessary at all when Indy already does that registration during unit initialization when REGISTER_EXPECTED_MEMORY_LEAK is defined, which it is by default when FREE_ON_FINAL is not defined, and either HAS_System_RegisterExpectedMemoryLeak or USE_FASTMM4 are defined.

4 hours ago, limelect said:

P.S I tried FREE_ON_FINAL as Remy suggested but I am not sure I compile/Build Indy with my project

Yes, that is the correct solution.  You have to recompile Indy for it to take effect.  The simplest way would be to have your project refer to Indy's source files directly so they compile directly into the executable.  If you have installed Indy into the IDE, you will have to recompile the installed BPLs instead.

Share this post


Link to post

@Remy Lebeau I took your suggestion and BUILD indy 10 with

{$DEFINE FREE_ON_FINAL} in the include

Made sure I did compile (build) as I have all DCU in the indy directory

And it did not help

I am trying all kinds of solution that why

 

Screenshot - 19_07_2022 , 19_40_02.jpg

Edited by limelect

Share this post


Link to post
3 hours ago, limelect said:

@Remy Lebeau I took your suggestion and BUILD indy 10 with

{$DEFINE FREE_ON_FINAL} in the include

Made sure I did compile (build) as I have all DCU in the indy directory

And it did not help

Then you are likely not building with the DCUs you just compiled.  Did you remove Indy from the IDE first? Did you update the IDE's search paths?

https://github.com/IndySockets/Indy/wiki/Updating-Indy

 

Also, which platform are you running your code on? The leaks you have showed are the intentional Indy leaks that should not be appearing on Windows, as they are "registered by pointer", as the dialog says.

Edited by Remy Lebeau

Share this post


Link to post

@Remy Lebeau I am with D10.2.3. I run my application on the IDE and see afterward the Indy DCU that before they weren't there

so I guess my software uses the compiled INDY. (on the source Delphi directory).

I did not remove INDY but I am sure I compiled with INDY DCU I made.

Well not to bother anymore I will leave the problem as it is.

It does not affect my program.

 

OUT OF CURIOSITY it is this program  https://limelect.com/downloads/document-projects/

 

and thanks again

Share this post


Link to post
10 hours ago, limelect said:

@Remy Lebeau I am with D10.2.3. I run my application on the IDE and see afterward the Indy DCU that before they weren't there

so I guess my software uses the compiled INDY. (on the source Delphi directory).

I did not remove INDY but I am sure I compiled with INDY DCU I made.

Indy comes pre-installed in the IDE.  If you want to use your own compiled version of Indy, you should remove the pre-installed one to avoid conflicts.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×