IdComponent memory leak ?

Giganews Newsgroups
Subject: IdComponent memory leak ?
Posted by:  yarod (nospame@nowhere.net)
Date: Wed, 03 Dec 2003

Hello,

In IdComponent.pas, a critical section is created in the initialization. But
the finalization does not free it and contains a strange comment.

My memory manager sees it as a memory leak. Can someone explains how freeing
critical section will cause a GPF (or AV) ?

--- 8< ---
initialization
  GStackCriticalSection := TCriticalSection.Create;
finalization
  // Dont Free. If shutdown is from another Init section, it can cause GPF
when stack
  // tries to access it. App will kill it off anyways, so just let it leak
  //FreeAndNil(GStackCriticalSection);
end.

--
best regards,
Yarod.

Replies