_memrpt Memory Report

Top  Previous  Next

 

Targets: All except BP7

 

The Memory Report helps you find possible memory leaks in your code.

 

 

Local objects with unprotected calls to Free (MEMO1)

 

This section reports locations where calls to Free (and FreeAsNil or Release) are not done in try-finally blocks. Failure to wrap a try-finally block around a memory deallocation could result in a memory leak. The report does not list locations in FormDestroy and FormClose events, because these are normally called when a form is destroyed. Neither does it report calls to Free from a finalization block. Also an object that is freed in a try-except block is not reported.

 

__________________________________________________

 

Non-local objects with unprotected calls to Free (MEMO2)

 

 

Like the previous section, but for non-local objects.

 

__________________________________________________

 

Objects created in try-structure (MEMO3)

 

 

This section lists lists locations where an object is created inside a try-structure, like:

 

clip0102

 

Here, Obj should be created before the “try”, otherwise Obj.Free will be called even if the object fails to create, possibly causing a runtime error.

 

__________________________________________________

 

Unbalanced Create/Free (MEMO4)

 

 

This section reports objects that are not created and freed the same number of times.

This can indicate an error, like in the following example:

 

clip0103

 

Here, the locally declared object Obj is never freed, so this code will cause a memory leak.

 

__________________________________________________

 

Local objects that are created more than once without being freed in-between (MEMO5)

 

 

This section reports objects that are created more than once (in a row) without being freed in-between.

This leads to memory leakage, like in the following example:

 

clip0104

 

Here, the locally declared object Obj is only freed once, which causes a memory leak.

 

__________________________________________________

 

Local objects that are referenced before being created (MEMO6)

 

 

This section reports objects that are referenced before being created.

This leads to an exception, like in the following example:

 

clip0105

 

Objects that PAL cannot determine have been created at all, are not reported, only those cases where the object has been created further down in the code. Otherwise there should be many false positives.

__________________________________________________

 

Local objects that are referenced after being freed (MEMO7)

 

 

This section reports objects that are freed but referenced further down in the code.

This leads to an exception, like in the following example:

 

clip0106

 

 

See also:

 

R_GEN General Reports