Have to reopen this one.
Scenario as follows:
In a library with exported flat functions.
Class1=MainThread
Class2=ChildThread
Class3=Database-Object
Class4=LogFile
Class1 creates Class2 which creates Class3, which creates Class4
The Exception occurs in Class 3, which i catch with a Try-Except (Class 3 is my "Representation" of a Database with all the Toys - Connection, Transaction, Query).
The Query creates the exception (an SQL-Statement checking if a table exists (SELECT * FROM UnknownTable) - If table unknown raise red flags)
What i don't understand: If everything is OK, no Memory leak and all objects are freed properly (otherwise i'd have leaks).
If the Exception occurs, i have a memory leak.
I've stepped through the whole code with no error, and even my Logfile shows proper chaining in freeing the objects.
All my procedure-calls transmit a result-message back to the start of the chain, which i evaluate, and if an error occured (like the Exception mentioned), i trigger the standard chain of destroying all objects (starting with class4, back to class 3, back to class 2, and finally back to class 1)
This standard-chain of freeing the objects is used, if everything went well! And there i have no leaks.
What am i missing?
EDIT: No Pointers at play. I use exactly one Pointer-Variable in my testing-project (Pointer to Record), which i dispose of after passing it to the library.
(Even tried setting it to nil inside the library. No difference, as well for the good result as well as the bad result)