While uploading videos, we see a memory leak in the system.

This could be possibly because of the library in thumbnail generator used in Bahmni (jcodec). We have our own implementation specific thumbnail generator (ffmpegframegrabber). We made sure that the memory leak is not because of the library used in our implementation by removing our implementation specific thumbnail generator. When we upload 5 to 10 videos with size 5 to 10 MB. RAM size is increased to 915 MB to 1.1 GB.

The corresponding jira ticket here:https://bahmni.atlassian.net/browse/BAH-463

@maharjun, as I asked on BAH-463:

Maharjun M, wherever JCodec is used, could it be that some streams are not being closed after manipulating the videos?

Looks like we have been flushing the resized image but not the actual image (here). We have to call flush() on all buffered images to clear the cache (has reconstructable resources). Works fine in my local. Will test in one additional environment and push the fix if everything works fine.



@shruthipitta, on the JIRA ticket, it would be useful to point to 1) the place where it is done and 2) the place where it is not done (but should be done). Even if this is still just a temporary guess and that you are still trying things out.

1 Like