I receive leak reports from EurekaLog in a blank empty VCL application.
- You did not set up your project properly, so EurekaLog's leak checking code is running too early.
- You may see technical leaks. See below for an example.
Example (technical leak):
- When application exits: RTL enters shutdown cycle inside _cleanup() routine from initexit.c file. This routine will call any registered finalization subroutine (e.g. exit procedure), such as EurekaLog and I/O streams finalization.
- C++ RTL will flush opened streams during shutdown (fflush() routine from fflush.c file is called from _exit_streams() finalization routine from streams.c file).
- Unfortunately, flushing stream will keep an allocated memory block used for stream locking (lock is allocated from _lock_stream() from streams.c).
- This memory block will remain alive, even when other code (including EurekaLog) cleanup (inside cleanup cycle in the _cleanup() routine).
- EurekaLog will detect memory block that was allocated, but not freed. EurekaLog will report this block as leak.
- Once EurekaLog (and other code) finishes shutdown - RTL will continue to cleanup.
- RTL will delete allocated locks by calling _cleanup_handle_locks() and _cleanup_stream_locks() (after _cleanup() routine completes) and terminate the process.
- Follow our guidelines for setting up your project for leak reporting. Basically, you need to ensure that EurekaLog's code is initialized first and finalized last. Otherwise, EurekaLog's leak checking code will run when there are unallocated resources. Such resources will be reported as leaks, even though it is finalized later.
- Ignore technical leaks. You may try to add such leaks as expected leaks. Or you may try to cleanup such leaks manually before execution of EurekaLog's leaks checking. E.g. calling routines such as _cleanup_stream_locks() at shutdown. But this may not always be possible.