Giter VIP home page Giter VIP logo

Comments (11)

neilcsmith-net avatar neilcsmith-net commented on May 30, 2024

You almost certainly do not want to call Gst.deinit() - please see the documentation of this function upstream - https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-Gst.html#gst-deinit

How are you measuring that memory is not released, and what exactly is remaining in memory?

from gst1-java-core.

lucgeo avatar lucgeo commented on May 30, 2024

Hi,

Thank you for your answer.
I measure the memory running "htop" command on Linux. I use a custom gstreamer element: https://github.com/alumae/gst-kaldi-nnet2-online. It is a gstreamer module created around a text-to-speech decoder that uses the Kaldi toolkit.
All I want is to have a main class that runs continuously on a server. From this I can start new threads in which I initialize a new gstreamer pipeline and I add to it this custom speech decoder element. For this element I set some attributes that consumes a very significant amount of memory. At the end of the thread execution I want to release the memory occupied by this element. I'm almost sure the resources of this element are remaining in memory now.

from gst1-java-core.

neilcsmith-net avatar neilcsmith-net commented on May 30, 2024

Are you manually disposing the pipelines when you're done with them? If all the heavy memory usage is outside of the JVM heap then relying on GC to collect it might be a problem.

from gst1-java-core.

lucgeo avatar lucgeo commented on May 30, 2024

I'm not sure if I understand correctly what you mean by "manually disposing," but in the thread where I run gstreamer, when the task is done, I call something like "pipe.setState (State.NULL)" and "pipe.dispose () ".

from gst1-java-core.

neilcsmith-net avatar neilcsmith-net commented on May 30, 2024

Exactly that, yes! So, it's possible you've uncovered a memory leak in the bindings, or a memory leak in the custom element, or something else. Now you just need to find which. 😄 Can you monitor with VisualVM? Try seeing if there are any objects under org.freedesktop.gstreamer being kept in memory longer than expected.

What are these attributes that you're setting? How do you set them?

from gst1-java-core.

lucgeo avatar lucgeo commented on May 30, 2024

I attach here a snippet to exemplify how I create the custom element and I set its attributes.
asr = ElementFactory.make("kaldinnet2onlinedecoder", "asr");
asr.set("nnet-mode", NNET_RECIPE_TYPE);
asr.set("use-threaded-decoder", FALSE);
asr.set("fst", DECODING_GRAPH);
asr.set("model", MODEL);
asr.set("word-syms", WORDS);
asr.set("feature-type",FEATURE_TYPE);
asr.set("mfcc-config", MFCC_CONFIG);
asr.set("ivector-extraction-config", IVECTOR_EXTRACTION_CONFIG);
asr.set("endpoint-silence-phones", SILENCE_PHONES);
asr.set("max-active", MAX_ACTIVE);
asr.set("beam", BEAM);
asr.set("lattice-beam", LATTICE_BEAM);
asr.set("acoustic-scale", ACOUSTIC_SCALE);
asr.set("lm-fst", DECODING_LM_FST);
asr.set("big-lm-const-arpa", RESCORING_LM_FST);
asr.set("phone-syms", PHONES);
asr.set("word-boundary-file", WORD_BOUNDARY);
asr.set("silent", SILENT);
asr.set("do-phone-alignment", PHONE_ALIGNMENT);
asr.set("do-endpointing", ENDPOINTING);

For example, the decoding graph (DECODING_GRAPH), acoustic model (MODEL) and the decoding / rescoring language model (DECODING_LM_FST, RESCORING_LM_FST) are quite large resources.

I will inspect the issue with Visual VM and come back with info.

from gst1-java-core.

neilcsmith-net avatar neilcsmith-net commented on May 30, 2024

But what Java types are MODEL, etc?

from gst1-java-core.

lucgeo avatar lucgeo commented on May 30, 2024

They are not standard Java data types. "Model" represents the path to a file created using Kaldi speech recognition toolkit.

from gst1-java-core.

neilcsmith-net avatar neilcsmith-net commented on May 30, 2024

They have to be a Java type of some sort! Just trying to figure out if you're passing anything in that might hold a significant amount of memory on the Java side, or whether everything is allocated by the custom element. eg. assuming a path, you're passing in something like String or URI and the custom element is loading the data?

from gst1-java-core.

lucgeo avatar lucgeo commented on May 30, 2024

Exactly, the custom element is loading the data. I just pass to it a String representing the path to resource.

from gst1-java-core.

neilcsmith-net avatar neilcsmith-net commented on May 30, 2024

Closing this for now. Please open another issue if you find a cause of memory leaks on our end rather than in the GStreamer plugin. Thanks, Neil

from gst1-java-core.

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.