These are chat archives for IndySockets/Indy

6th
Aug 2018
Marcos Douglas B. Santos
@mdbs99
Aug 06 2018 01:18
Hello.
I have an issue very strange using FPC 3.1.1 and Laz 1.9. I have no memleaks in my project, but If I add an Indy unit, eg. IdPOP3, I have 3 memleaks
Marcos Douglas B. Santos
@mdbs99
Aug 06 2018 03:44
Here is the problem:
  GThreadCount := TIdThreadSafeInteger.Create;
  {$IFNDEF FREE_ON_FINAL}
    {$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
  IndyRegisterExpectedMemoryLeak(GThreadCount);
  IndyRegisterExpectedMemoryLeak(TIdThreadSafeIntegerAccess(GThreadCount).FCriticalSection);
    {$ENDIF}
  {$ENDIF}
finalization
  // This call hangs if not all threads have been properly destroyed.
  // But without this, bad threads can often have worse results. Catch 22.
//  TIdThread.WaitAllThreadsTerminated;

  {$IFDEF FREE_ON_FINAL}
  //only enable this if you know your code exits thread-clean
  FreeAndNil(GThreadCount);
  {$ENDIF}
So, "only enable this if you know your code exits thread-clean" is this make sense?

...in IdThread.pas but there is another in IdStack.pas... and why do we have an *.inc in each directory with the same information??

Of course we need to enable FREE_ON_FINAL... why not?

Marcos Douglas B. Santos
@mdbs99
Aug 06 2018 12:27
IMHO this is an issue... so I've posted IndySockets/Indy#225
Remy Lebeau
@rlebeau
Aug 06 2018 17:33
@mdbs99 I've commented on it