Giter Club home page Giter Club logo

Comments (5)

Jugen avatar Jugen commented on June 6, 2024

Ideally you would like to only append the text to outputTextArea that was appended to the log file and not the whole log file every time.
To control the size of your displayed log you could track how many paragraphs there are after each append and remove the first few that exceed your set limit, something like:

outputTextArea.appendText( newLogLines );
int excessLines = outputTextArea.getParagraphs().size() - maxLines;
if ( excessLines > 0 ) outputTextArea.deleteText( 0, 0, excessLines, 0 );

from richtextfx.

zkycaesar avatar zkycaesar commented on June 6, 2024

@Jugen Thanks for the reply.

The another reason why I replace the whole text is that, there maybe several log files. Everytime the users can see only one of these files, but they may switch between these files frequently. And it seems the memory usage of the StyleClassedTextArea is pretty high (I wonder what caused that). So I thought, maybe it's best to maintain only one StyleClassedTextArea, and replace the log text whenever the user switch the log file.

So in your opintion, what should I do? Maintain only one StyleClassedTextArea, or one for each log file? And is there a way to reduce the memory usage?

from richtextfx.

Jugen avatar Jugen commented on June 6, 2024

By what you've described I would just maintain one. The memory usage may come down if instead of replacing everything for the current log being viewed you rather use the mechanism I described above to update the text area.

from richtextfx.

zkycaesar avatar zkycaesar commented on June 6, 2024

I noticed that for a 44MB string, the StyleClassedTextArea will consume more than 300MB memory, and quite some temporary memory. Is this the normal case?

image

If I don't need to apply any customed styles, is it possible to reduce the memory consumption?

from richtextfx.

Jugen avatar Jugen commented on June 6, 2024

Is this the normal case?

It seems to be ? I tried with an 8MB text file and the memory used was 200MB.

However it does feel a bit excessive though doesn't it ? I also tried the same 8MB text file using an ordinary TextArea and that used a whopping 1GB !!!

Still it seems strange, I wonder why Paragraph and ReadOnlyStyledDocument seem to need so much memory ?

from richtextfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.