You are not logged in.
Pages: 1
Hi ab,
recently I updated the source
I have example declaration in GUI application:
TMyLog = class (TSQLLog);
no methods, constructors, destructors.
When shutting down I get AV exception at TSynLog.Destroy when called from GarbageCollectorFree's
FreeAndNil(PObject(GarbageCollectorFreeAndNilList.List[i])^);
on SynCommons finalization.
Debugging shows that
PObject(GarbageCollectorFreeAndNilList[i])^
is nil. Even it is nil, TMyLog leaks, along with other TSQLLog and TObjectList.
It is heavy multithreaded application using the log. If I step through or delay the finalization, many times I do not get the exception.
Do you have any clue what should be the problem or want me to go further with debugging?
Thanks.
Offline
Long time ago I discover problem with Log and heavy multithreaded application. I don't test is it exist in current version, but try to set Log.Family.PerThreadLog := ptOneFilePerThread; In my case it solve the problem.
Offline
It does not helped, setting only ptOneFilePerThread.
If I set usual stuff even my application does not shut down. Some finalization block, maybe at some critical section.
I think the problem is deeper, maybe in so called "Garbage Collector". I get other strange random leaks of mORMot created objects, just analyzing some in FastMM leak reports.
Offline
Try for example 01 - In Memory ORM with ReportMemoryLeaksOnShutdown := True; --> Leaks
I suspect even "uses SynCommons" leaks.
Another example is SynCommons Initialization GarbageCollectorFreeAndNil(SynAnsiConvertList,TObjectList.Create)
Here instance of TObjectList leaks. (not freed on finalization)
Will investigate GarbageCollector, bu I think Ab should have a clue where the problem should be and save me some time
Thanks.
Edited: It was my mistake, above initialization and finalization works fine. Sorry
Last edited by chapa (2013-09-20 08:27:21)
Offline
I should also note, that I made following change in GarbageCollectorFree in order to avoid AVs:
if Assigned(PObject(GarbageCollectorFreeAndNilList.List[i])^) then // note: added by chapa
FreeAndNil(PObject(GarbageCollectorFreeAndNilList.List[i])^);
Edited: And everything seems working fine, no leaks or AVs so far, but will full test again and report if have any problems.
Last edited by chapa (2013-09-20 08:28:25)
Offline
Did you try with the latest unstable version?
A lot of fixes have been done about multi-threading.
We also run all regression tests with memory leak reporting set to ON.
For safety, I've added your fix proposal, checking PObject(GarbageCollectorFreeAndNilList.List(i))^ is not nil.
Offline
Pages: 1