Removing custom dictionary from memory

2 posts, 0 answers
  1. Robert
    Robert avatar
    1 posts
    Member since:
    Jun 2012

    Posted 14 May 2013 Link to this post

    Hi,

    We have implemented our own CustomDictionary class (derived from RadDictionary and implementing the
     ICustomWordDictionary interface), and in an attempt to keep the Silverlight memory footprint small, we removed the RichTextBox's default CustomDictionary and called its Dispose method.  However, when analyzing the application in a memory profiler, we can see that the original RadIsolatedStorageCustomDictionary (the one we attempted to remove) is still taking up about 2.3 MB.  Comparing our application to the unmodified Telerik demo in the profiler, we see that our app has 2 CustomDictionary objects held in memory, while the demo has only 1.

    Is there any way to completely remove the default dictionary from memory?  The MSDN documentation recommends calling Dispose on IsolatedStorageFile objects before releasing any references to them; I'm already calling Dispose, then DocumentSpellChecker.RemoveCustomDictionary (which returns success), but I don't know what else may hold a reference to this object.
  2. Boby
    Admin
    Boby avatar
    595 posts

    Posted 17 May 2013 Link to this post

    Hi Robert,
    You can remove the default custom dictionary and the register a custom one using the DocumentSpellChecker.RemoveCustomDictionary method:
    DocumentSpellChecker spellChecker = (DocumentSpellChecker)this.radRichTextBox.SpellChecker
    spellChecker.RemoveCustomDictionary(CultureInfo.InvariantCulture);
    spellChecker.AddCustomDictionary(...)
    After some time (when the garbage collector clean the memory) the default RadIsolatedStorageCustomDictionary should be cleared from the memory.

    All the best,
    Boby
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top