How can I minimize memory impact when using Document.ReplaceText?

SyntaxEditor for WPF Forum

Posted 12 years ago by Craig - Varigence, Inc.
Version: 11.2.0552

I have a SyntaxEditor whose document is updated via the ReplaceText method. This makes me wonder about the memory impact of repeatedly replacing a document's text, assuming a large document. For instance, do I need to worry about the editor caching older versions of a large document? Does the editor's undo stack cache older versions, potentially consuming excess memory?

Assuming I need to continue relying on ReplaceText, are there any recommended steps for minimizing the editor's memory usage? Alternatively, is the memory usage actually minimal?



Comments (1)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Craig,

We do keep some back snapshots of documents but only as long as they are referenced by something.  As soon as nothing references those older snapshots, they drop out of memory.  We have a very nice internal design for our document text storage so even if you have a lot of snapshots active at a time for a document, a good portion of them (the common parts) will be shared between snapshots.

The undo stack will grow as you do text changes but I believe we have a limit (100 off the top of my head) on the item count that can be added.  After that, the old undo history items drop off.  Also, you can clear the undo history at any time if you wish.

Using ReplaceText is fine for making replacements.

Actipro Software Support

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.