Out of Memory exception in Syntax Editor

SyntaxEditor for Windows Forms Forum

Posted 10 years ago by Sakthivel
Version: 4.0.0262
Avatar
Hi,

We are using the Syntax Editor control to display entire data from a file of about 250MB by highlighting some of the data using Lexical Pattern.

While inserting the data as several chunks to the Syntax Editor tool, we are getting "Out of Memory" exception.

We are inserting the text in the following way:

syntaxEditor.Document.InsertText(DocumentModificationType.Typing, RawData.Document.Length, allDevices.ToString(), DocumentModificationOptions.None);

syntaxEditor.Document.UndoRedo.Clear();

After reading data from the file, the memory consumed was about 16MB. But once we started inserting data into the control, the memory usage was started raising dramatically and was consumed about 1,120,168K(as got from the Task Manager) and memory usage was above the 1024MB (as per memory profiler) mark at the time of the "Out of Memory" exception.

Please help us on how shall we overcome this problem.

We are using Syntax Editor-4.0.0262 in VS 2008

Thanks in advance.
Sakthi.

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sakthi,

Keep in mind that SyntaxEditor is storing token information for all text that is in the document. So for large documents, the related memory required will be several times that (storing data for document line offsets, display line offsets, token data, etc.). A 250MB document would consume more than 250MB of memory. There is a "Large File Handling" topic you'll want to read in the documentation. That may help some (since turning off various features such as lexical parsing, etc. will definitely cut down memory usage). But still you'd be better off breaking up your document into smaller parts and only showing those a bit at a time.

We have done a lot of work over the past year on a newer text/parsing framework that is being prototyped with our WPF version of SyntaxEditor. With that, we virtualize as much data as we can so that there is a dramatic reduction in non-text-related memory usage. Once the WPF version's feature set is mostly complete, we hope to port that design back to WinForms.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.