Results 1 to 2 of 2

Thread: Held Memory by GC Roots

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    18

    Default Held Memory by GC Roots

    During my STSdb4 implementation on large data sets, I've noticed a rather simple but important note on using the StorageEngine. As it's obvious StorageEngine is there to hold large amount of data either in RAM or disk.

    The usual usage of a StorageEngine is like below:
    static void Main(string[] args) 
    {
    using (IStorageEngine infoEngine = STSdb.FromHeap(new Heap(new FileStream("info.stsdb4", FileMode.OpenOrCreate), true)))
    {
    // do some insert and lookup
    
    infoEngine.Commit();
    infoEngine.Close();
    
    }
    
    // At this point Memory is held by StorageEngine and is not released yet
    
    Console.ReadKey();
    
    }
    
    You may think that after the using statement, the used memory by StorageEngine will be released since using will call Dispose on the object. That's true and the StorageEngine object will be disposed upon leaving the using block. But there's a missing point here. If you take a memory snapshot of the app just before the Console.ReadKey() line, you'll see the following snapshot (taken using ANTS Memory Profiler).

    The point is that, Local variables is one the GC Roots (c# - What is a "rooted reference"? - Stack Overflow) and so as it's obvious in attached picture, the infoEngine variable is a GC Root and will hold all the its allocated children objects (in my sample wasting 27 MB of memory).

    The easy solution to have proper memory counting would be to make the code working with engine wrapped in a simple method like this:

    static void Main(string[] args) 
    {
    
    DoDBOperations();
    
    // At this point Memory is released
    
    Console.ReadKey();
    
    }
    
    public static void DoDBOperations()
    {
    
    using (IStorageEngine infoEngine = STSdb.FromHeap(new Heap(new FileStream("info.stsdb4", FileMode.OpenOrCreate), true)))
    {
    // do some insert and lookup
    
    infoEngine.Commit();
    infoEngine.Close();
    
    }
    
    }
    

  2. #2
    Junior Member
    Join Date
    Oct 2017
    Posts
    1

    Default Free Full Movies Downloads Online-- The Comfort As Well As Enjoyable

    I'll say it in advance. I like to sit in your home, in my shorts, a canister of beer in hand and a number of buddies spending time, enjoying the most recent free flick downloads online we could possibly see. Its wonderful enjoyable being able to invite your close friends over and also have this "movie download argument"-- which cost-free movie downloads do we download online today?!!? ... Currently in an extra major note ... it really is a real treat to be able to rest at the convenience of my own home and see the current, most preferred film downloads on-line I ever before wish to see-- free of charge. The net allows us to do numerous points today-- make new buddies, shop, see away places, listen to songs, enjoy cost-free movie downloads online as well as far more. I am a movie fanatic as well as that there are some terrific totally free movie download sites-- makes my life so much far better, enjoyable as well as comfy. Free movie downloads online make my life really hassle-free. Not should most likely to the film rental shop however just get online as well as download whatever I select - is shear enjoyable. A major advantage is that I don't need to pay every single time view my favorite films. Free Movies Downloads Online - The Legal Movie Downloads means ... I should emphasize. The Free Online Film Downloads that I enjoy and also very suggest are all legal movie download sites. These film websites I enjoy are all legitimate and also legal. These websites are spyware and adware cost-free and assure no pop-ups and also promotions. Downloading and install is protected as well as is safeguarded versus any viral assaults. This is very important as well as not to be ignored. These websites have client service as well as deal 24-hour customer support which is always really good to have, especially when you encounter some unforeseen problems ... Free Movie Downloads Online-- The method it works ... Developed lawful totally free movie downloads on the internet websites are very fast. All you should do is strategy which films you intend to see that evening, click a couple of clicks as well as the cost-free flick downloads await your later watching. Free motion picture downloads on-line websites provide a life time membership. When a participant, you could gain access to basically unlimited film downloads. Pay an one time low payment for a life time gain access to as well as from there on there are no added prices. Download as several totally free complete variation, complete size flicks on-line whenever you desire. Discovering more regarding free movie downloads online ... To learn more about complimentary motion picture downloads online, and my top personal referral websites, please click the web links below. Welcome To Go GoMovies

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
2002 - 2014 STS Soft SC. All Rights reserved.
STSdb, Waterfall Tree and WTree are registered trademarks of STS Soft SC.