FetchTypedList memory leak?

Posts   
 
    
joshmag
User
Posts: 14
Joined: 20-Aug-2021
# Posted on: 29-May-2023 10:50:59   

Hi,

I am using the FetchTypedList function in the same way show in this document:

https://www.llblgen.com/documentation/5.2/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/Using%20TypedViews,%20TypedLists%20and%20Dynamic%20Lists/gencode_usingtypedlist_adapter.htm

OrderCustomerTypedList orderCustomer = new OrderCustomerTypedList();
using(DataAccessAdapter adapter = new DataAccessAdapter())
{
    PredicateExpression additionalFilter = new PredicateExpression(CustomerFields.Country == "Brazil");
    ISortExpression sorter = new SortExpression(OrderFields.OrderId | SortOperator.Ascending);
    adapter.FetchTypedList(orderCustomer, additionalFilter, 0, sorter, false);
}

However, I noticed that the data I fetch stay in memory forever (I verified this using vvmap). Am I supposed to clear the type list when I'm done? Is there some method I need to call to clean it up?

BTW, I am using llblgen 5.2 with Sybase ASE.

PS: Also, the data that is not being cleared is in the heap, not the managed heap. So maybe the leak, if there is one, is in the Sybase driver.

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39616
Joined: 17-Aug-2003
# Posted on: 29-May-2023 11:16:31   

One of the reasons we stopped supporting Sybase was indeed memory leaks in their ado.net providers (among other bugs), despite the fact we do call dispose on everything that exposes IDisposable...

The typedlist is a datatable, so data fetched in the typedlist stays in memory till it goes out of scope. If you don't add event handlers to the typedlists's (datatable's) events (which might keep it in memory!) it should be a gc candidate once it's out of scope.

Frans Bouma | Lead developer LLBLGen Pro
joshmag
User
Posts: 14
Joined: 20-Aug-2021
# Posted on: 29-May-2023 13:48:29   

Otis wrote:

One of the reasons we stopped supporting Sybase was indeed memory leaks in their ado.net providers (among other bugs), despite the fact we do call dispose on everything that exposes IDisposable...

The typedlist is a datatable, so data fetched in the typedlist stays in memory till it goes out of scope. If you don't add event handlers to the typedlists's (datatable's) events (which might keep it in memory!) it should be a gc candidate once it's out of scope.

Ok, thanks for letting me know that I don't have to explicitly clear anything.