# Ridiculous RAM usage problem!

**URL:** https://quelea.discourse.group/t/ridiculous-ram-usage-problem/1165
**Category:** Uncategorized
**Created:** [September 30, 2024, 2:31pm UTC](https://quelea.discourse.group/t/ridiculous-ram-usage-problem/1165 "2024-09-30T14:31:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![JessyJP](https://yyz2.discourse-cdn.com/free1/user_avatar/quelea.discourse.group/jessyjp/32/292_2.png) [@JessyJP](https://quelea.discourse.group/u/JessyJP)
#### Post date: [September 30, 2024, 2:31pm UTC](https://quelea.discourse.group/t/ridiculous-ram-usage-problem/1165/1 "2024-09-30T14:31:34Z")

</div>

Has nobody noticed the ridiculous RAM usage?! Any power users out there ?  
Here is a bit of context:  
On my machine a fresh install is ~680 MB (it’s not miniscule but acceptable)  
Add bibles a few bibles ~730MB. Not too bad.  
The put the usual settings file and the rest of the configurations except videos and I get 1060 MB. (Well that quite the increase but still reasonable on a modern machine).  
Now put just 2.3 GB worth of videos in the video directory and suddenly we have about 3300+ MB ram usage… what ?

So let’s just grab those same videos and just copy paste them to make copies of them in the same directory. Run Quelea again.

 ![image](https://global.discourse-cdn.com/free1/uploads/quelea/original/1X/7efb0ccef2da279034a61e85f0257aed29119fe5.png)

Wait what ?! 4.5 GB and what is this constant 15% CPU (about 1 core) and 35% GPU ?!?! At idle?!

So earlier I had around 200 short background clips and somehow I and managed to spike the ram utilization to about 23 GB after I just left it to idle a while.

============  
I checked the settings for a caching mechanism for the videos but even with the video panel off there was no change in the ram utilization. I think at this point it’s clear the program is caching the videos and not in a good way.

---

<div class="post-metadata">

### Author: ![JessyJP](https://yyz2.discourse-cdn.com/free1/user_avatar/quelea.discourse.group/jessyjp/32/292_2.png) [@JessyJP](https://quelea.discourse.group/u/JessyJP)
#### Post date: [September 30, 2024, 10:23pm UTC](https://quelea.discourse.group/t/ridiculous-ram-usage-problem/1165/2 "2024-09-30T22:23:56Z")

</div>

I traced the code and there are 2 places that cause the balloon:

Quelea\src\main\java\org\quelea\windows\library\VideoListPanel.java :

> @@ -142,7 +142,7 @@ public class VideoListPanel extends BorderPane {  
> File file = files[i];  
> LOGGER.log(Level.INFO, “Checking file {0}”, file);  
> if (Utils.fileIsVideo(file) && !file.isDirectory()) {  
> addVideoFile(file);  
> // addVideoFile(file);  
> }  
> }  
> });

Quelea\src\main\java\org\quelea\windows\lyrics\LyricDrawer.java :

> @@ -403,13 +403,13 @@ public class LyricDrawer extends WordDrawer {  
> Color color = ((ColourBackground) theme.getBackground()).getColour();  
> image = Utils.getImageFromColour(color);  
> } else if (theme.getBackground() instanceof VideoBackground) {  
> var uri = ((VideoBackground) theme.getBackground()).getVideoFile().toURI();  
> if(!Objects.equals(vidDisplay.getUri(), uri)) {  
> vidDisplay.stop();  
> vidDisplay.setURI(uri);  
> vidDisplay.play();  
> }  
> newImageView.imageProperty().bind(vidDisplay.imageProperty());  
> // var uri = ((VideoBackground) theme.getBackground()).getVideoFile().toURI();  
> // if(!Objects.equals(vidDisplay.getUri(), uri)) {  
> // vidDisplay.stop();  
> // vidDisplay.setURI(uri);  
> // vidDisplay.play();  
> // }  
> // newImageView.imageProperty().bind(vidDisplay.imageProperty());  
> } else {  
> LOGGER.log(Level.SEVERE, "Bug: Unhandled theme background case, trying to use default background: " + theme.getBackground(), new RuntimeException(“DEBUG EXCEPTION FOR STACK TRACE”));

So if I comment out those two places creating the video cards and the theme then it’s fine.

---

<div class="post-metadata">

### Author: ![JessyJP](https://yyz2.discourse-cdn.com/free1/user_avatar/quelea.discourse.group/jessyjp/32/292_2.png) [@JessyJP](https://quelea.discourse.group/u/JessyJP)
#### Post date: [September 30, 2024, 11:36pm UTC](https://quelea.discourse.group/t/ridiculous-ram-usage-problem/1165/3 "2024-09-30T23:36:23Z")

</div>

I narrowed it down to a GStreamer memory leak. Or maybe it’s the wrapper.  
Every time a video is played the resources from the previous stream are not properly released.

---

<div class="post-metadata">

### Author: ![berry120](https://yyz2.discourse-cdn.com/free1/user_avatar/quelea.discourse.group/berry120/32/4_2.png) [@berry120](https://quelea.discourse.group/u/berry120)
#### Post date: [November 8, 2024, 4:55pm UTC](https://quelea.discourse.group/t/ridiculous-ram-usage-problem/1165/4 "2024-11-08T16:55:40Z")

</div>

Thanks for the report - I’ll take a look.
