LLBL Memory footprint

Posts   
 
    
imakimak
User
Posts: 62
Joined: 18-Mar-2010
# Posted on: 13-Apr-2011 17:45:13   

C# .NET Framework 3.5 SQL Server 2008 LLBL Version 2.6 Final

If I load same table from database into a DataTable object vs an LLBL Collection; the size of LLBL collection instance is ~10 times bigger then DataTable instance. Do you think the memory foot print of LLBL object is that bigger or is there anything that I might be doing wrong?

If you can point to any doc on the memory footprint of LLBL object, that will be helpful too.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 13-Apr-2011 18:13:42   

A datatable is actually a list of object[] objects, so its memory footprint isn't much bigger than the data it contains. An entity class contains field objects and inside them there is extra data. Not much, but it's there. In v3 we reduced the memory footprint again, and the instantiation time as well. We do what we can to keep memory footprints to a bare minimum, but there is some data overhead when using an entity, it's a complex object, not an object[].

Btw, how are you measuring memory consumption? in debug mode, .net reserves a lot more memory for separate objects.

Frans Bouma | Lead developer LLBLGen Pro
imakimak
User
Posts: 62
Joined: 18-Mar-2010
# Posted on: 13-Apr-2011 18:20:26   

Release build, attach windbg/sos and run dumpheap command

I did a test again, before there were 1000 rows. This time I load 10,000 rows and LLBL collection is ~25 times bigger then DataTable object. This mean that more rows/data is been loaded, the ratio of foot print of these collections can go even higher. I understand what you are saying about entity class itself however I am not doing any PreFetch etc. Does this number (10-25 times) make sense? I am just afraid that I might be doing something wrong in this test.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 13-Apr-2011 20:25:24   

By loading 10 times the initial rows you shouldn't get 2.5 times the initial size, so something odd is going on (if 1 entity is 10 times the size of a datarow, you shouldn't get 25 times the size of a datarow). Do you use any dependency injection etc.? do you measure the memory right before the fetch and right after, or of the whole program? Could you do 2 fetches, one to get things started, and one for the real memory footprint? It's also better to use a memory profiler, as it's now measuring the complete memory footprint of the application.

Frans Bouma | Lead developer LLBLGen Pro