esteinberg / plantuml4idea

Intellij IDEA plugin for PlantUML
Apache License 2.0
633 stars 113 forks source link

Remote Render result with Localhost PlantUML PicoWeb cannot be zoomed #412

Open philCryoport opened 9 months ago

philCryoport commented 9 months ago

Hi! I build enormous sequence diagrams in PlantUML -- my current diagram is 375 lines and counting.

Trying to render that with the plugin's own PlantUML jar -- or with an external PlantUML jar (installed with MacOS Homebrew) -- very quickly pushes IntelliJ to report Out Of Memory errors.

So I run

java -DPLANTUML_LIMIT_SIZE=16384 -jar /opt/homebrew/Cellar/plantuml/1.2023.13/libexec/plantuml.jar -picoweb -verbose -failfast2

I then configure the PlantUML4Idea plugin to remote render using http://127.0.0.1:8080 -- and voila! I get sequence diagrams in the PlantUML preview window which appear to be generated by my localhost PlantUML PicoWeb instance.

However, I still get Out Of Memory Errors with IntelliJ with the "SVG Preview" feature enabled -- apparently that seems to use IntelliJ heap -- so I have to turn off SVG Preview to stop those Out Of Memory errors.

The result of "⬛️ SVG Preview ☑️ Remote Rendering"?

IntelliJ memory is fine, but the diagram in the PlantuML preview window will not allow me to zoom in or out -- and with a resulting image that is 4880x11434, the writing is tiny.

I will note that I've tried adding the -tsvg option to the java line above. Doesn't make a difference.

Help?

Here's the result of my "About IntelliJ Idea" window:

IntelliJ IDEA 2023.3.3 (Ultimate Edition)
Build #IU-233.14015.106, built on January 24, 2024
Licensed to  <redacted>
You have a perpetual fallback license for this version.
Subscription is active until January 20, 2025.
Runtime version: 17.0.9+7-b1087.11 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.3
GC: G1 Young Generation, G1 Old Generation
Memory: 5192M
Cores: 12
Metal Rendering is ON
Non-Bundled Plugins:
  PlantUML integration (7.5.1-IJ2023.2)
  com.intellij.ml.llm (233.14015.137)
Kotlin: 233.14015.106-IJ
krasa commented 9 months ago

You need more memory or a different IDE. Pixels take a lot of heap in Java. Also try to disable cache and scaling obrazek

philCryoport commented 9 months ago

You need more memory or a different IDE. Pixels take a lot of heap in Java. Also try to disable cache and scaling obrazek

So @krasa you're saying that the ability to zoom using remote rendering isn't possible?

PS adjusting for what you said above, here's what my PlantUML settings now look like:

image

I'll also note that with "SVG Preview OFF, Remote Rendering ON", when I click the zoom + / - buttons in the PlantUML Preview window, the PlantUML plugin is calling my Localhost PlantUML PicoWeb instance -- but still, the displayed Sequence Diagram is not zooming in or out...

Now I'm curious:

Is the remote render request returning a PNG or a SVG?

krasa commented 9 months ago

PlantUML PicoWeb does not zoom, you can do it only by source code.

@startuml
scale 101000*901000
...

It returns SVG for SVG Preview, otherwise PNG.

Zooming SVG should work.

There also might be a memory leak if your heap stays full obrazek

Easily diagnosable with https://eclipse.dev/mat/ I will do something about that one:

obrazek

philCryoport commented 9 months ago

Hi @krasa

As I've set the PLANTUML limit to 16384, I used: scale 16384x16384

It now fills the entire width of my 3360x1890 43" monitor. Much easier to read now! :)

I just enabled "Show Memory Indicator". Here's all "memory" Actions:

image

I've actually been monitoring the heap with VisualVM -- trying to prevent the OOM's by clicking the "Perform GC" when it gets too high. I recently restarted IntelliJ, so here's where we stand at this moment:

image

philCryoport commented 9 months ago

Just ordered a GC as it was getting close to the 5192M Xmx limit I imposed on IntelliJ:

image

krasa commented 9 months ago

That looks fine.

But you can try a new build if you like: plantuml4idea-7.6.0-IJ2023.2.zip

krasa commented 9 months ago

trying to prevent the OOM's by clicking the "Perform GC" when it gets too high.

that does not prevent OOM imho - it gets that high by design, some say it is possible but unlikely https://stackoverflow.com/a/8719124

philCryoport commented 9 months ago

trying to prevent the OOM's by clicking the "Perform GC" when it gets too high.

that does not prevent OOM imho - it gets that high by design, some say it is possible but unlikely stackoverflow.com/a/8719124

Thank you @krasa for the above. I need to complete my diagram ASAP so I'll try out the new build after I get that done.