-
Notifications
You must be signed in to change notification settings - Fork 237
[0.7-M3] OutOfMemoryError Loading Documents in the RichText Demo #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Aye, I can reproduce this. Stacktrace below: Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space
at java.util.ArrayList.<init>(ArrayList.java:152)
at org.fxmisc.richtext.model.SuperCodec$1.decode(SuperCodec.java:42)
at org.fxmisc.richtext.model.SuperCodec$1.decode(SuperCodec.java:24)
at org.fxmisc.richtext.model.ReadOnlyStyledDocument$2.decode(ReadOnlyStyledDocument.java:121)
at org.fxmisc.richtext.model.ReadOnlyStyledDocument$2.decode(ReadOnlyStyledDocument.java:106)
at org.fxmisc.richtext.demo.richtext.RichText.load(RichText.java:384)
at org.fxmisc.richtext.demo.richtext.RichText.loadDocument(RichText.java:371)
at org.fxmisc.richtext.demo.richtext.RichText$$Lambda$280/519621340.run(Unknown Source)
at org.fxmisc.richtext.demo.richtext.RichText.lambda$createButton$25(RichText.java:307)
at org.fxmisc.richtext.demo.richtext.RichText$$Lambda$287/1330693596.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8413)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) |
It attempts to create an |
It appears that loading only supports files that were previously saved by the editor. What is going on here is that some bytes from the input file are interpreted as an @afester Do you want to comment, since you added the load/save functionality to the demo? |
Wow.... yeah, that would make more sense since there's definitely not that many lines in the ReadMe file. |
I copied the ReadMe file's contents into the demo, saved it, and then loaded that document. No issues occurred. However, the println statement I added in the
|
Seems OK to me. There are 328 lines. Each line has a list (of size 1) of segments. That's a total number of 329 lists to be decoded. |
If we changed the file type in the save functionality and changed the load method to only look for that file type, then it would prevent this issue from arising. Additionally, adding a tooltip that explains the load button only works for previously saved documents through this demo could satisfactorily resolve this issue as it is not meant to load all kinds of documents (txt, PDF, docx, etc.), but to demonstrate a way that save/load functionality can be done. |
+1 for tooltip. Also, let's emphasize that this is a demo. The format of the saved file is arbitrary and there's no guarantee a file saved with one version of the demo can be loaded with newer versions. |
When loading documents in the demo, an OutOfMemoryError is thrown.
Steps to reproduce:
$ gradle RichText
.This occurs on both Windows 10 Pro, 64-bit and Ubuntu 16.04, 64-bit.
The text was updated successfully, but these errors were encountered: