Subject | Memory leak with IBObjects components ? |
---|---|
Author | |
Post date | 2015-04-02T12:59:39Z |
Hello IBObjects Support,
I've been using the IBO Service Framework for a project that uses CopyCat and IBObjects to replicate data. I noticed that memory usage was increasing every time replication ran so I looked through the code to find where it was leaking. While some leaks were fixed, I couldn't plug other leaks so I started to log memory usage at various steps throughout the application.
In one case, I noticed that a query that uses only a TIBOQuery component was consuming close to 5 KB every run and it wasn't being released when the query was closed or after the transaction was committed.
We constructed two tests (each in their own project) with the same memory logging code. The basic idea of the test is to log memory usage of a query and run the query multiple times to see if there is a leak or not.
The tests use a TIB_Connection, TIBOQuery, TIB_Transaction and TIB_Session components.
The first test uses a simple form. This test basically showed that while the query component allocated memory on it's first use, repeated use of the query component would re-use it's memory. From the second run, and on, it would allocate some small amount of memory which was freed when the query was closed.
The second project used a bare bones IBO Service Framework with the same query as the first test. This one showed that memory was steadily increasing even after it should've reached a steady state, indicating a leak.
So, while the first test showed that memory usage reaches a steady state after the first query run, the second test doesn't reach this same steady state. This doesn't mean that the query component is leaking memory, but it might be leaking memory. Maybe it is a problem when the components run in a thread?
I would be happy to provide our test source code we have written if that would be appropriate.
Thanks,
Phil Horst