Articles in this section

Why does out of memory exception arise on creating or opening large size documents in WPF RichTextBox?

The SfRichTextBoxAdv control keeps the entire rich text contents (text, images, tables, and all other supported elements along with their formatting) of the document and its corresponding information needed for rendering in the main memory. In the case of opening a Docx file, you may think the file size is small, but SfRichTextBoxAdv utilizes a very large amount of memory. This is because it is a zip archive file with the extension "docx," and the SfRichTextBoxAdv control internally decompresses it and populates the content in the document object model, utilizing significant main memory.

The SfRichTextBoxAdv control supports UI Virtualization. UI elements are created only for the contents that are visible in the viewer. The UI elements are created for the contents that become visible while scrolling the viewer; this reduces main memory utilization and also improves UI performance. Even though UI Virtualization is handled, the main memory utilization will increase with respect to the increase in content and its complexity. The main memory utilized by an instance will not be released until the instance is removed from the document.

Hence, there is a chance for an "Out of memory exception" when the memory utilization exceeds the maximum level as the content of the document increases. Kindly split the contents into several documents or use high-configuration machines with extended RAM to create or open large-size documents comfortably.

Conclusion

I hope you enjoyed learning about why an "Out of memory exception" arises when creating or opening large-size documents in WPF RichTextBox.

You can refer to our WPF RichTextBoX feature tour page to learn about its other groundbreaking feature representations. You can also explore our WPF RichTextBox documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to explore our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied