Open Access Still Alive after dispose

Thread is closed for posting
2 posts, 0 answers
  1. Jonah
    Jonah avatar
    28 posts
    Member since:
    Oct 2012

    Posted 02 Apr 2015 Link to this post

    I am been trying to track down memory issues with my WPF project. When running just trace, open access has many instances that have been disposed that are still alive. I am wondering if I am doing something wrong? I have my datacontext in a using statement and assumed that it would clean up when finished.
  2. Thomas
    Thomas avatar
    590 posts

    Posted 07 Apr 2015 Link to this post

    OpenAccess has to deal with several types of information:
    (a) meta information (class structure, field descriptions, table and columns, ...)
    (b) states (instances where the persistent content is stored)
    (c) user visible instances of enhanced, persistence-capable types.

    Meta information is bound to open database instances. Once you have opened a database (fired a query against the database for the first time), this meta information is fixed and won't increase in size. In order to dispose that, you will need to dispose/close the database. (see )

    All states are bound to the life time of the context. Once you have disposed the context, those GenericState instance will be gone too.

    User visible instances (from enhanced, user defined classes) are also managed by the OpenAccessContext instances, but can have additionally arbitrary cycles between them. Once the managing context is disposed, those user controlled cycles are left alone and nothing is forced to be in memory any longer. Normally, OpenAccess uses only weak references from the managing context to the user instances to permit GC to happen, and only in cases of modified instances there will be additional hard references.

    My best guess is that there is a static field somewhere through which those instances from (c) are held. 
    Or are those instances that JustTrace shows as alive of type (a) like ClassMetaData, FieldMetaData, RelationalTable...?

    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top