This is a migrated thread and some comments may be shown as answers.

Removing custom dictionary from memory

1 Answer 83 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 14 May 2013, 07:36 PM
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.

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 17 May 2013, 06:51 AM
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.

Tags
RichTextBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or