mupdf-rs icon indicating copy to clipboard operation
mupdf-rs copied to clipboard

Memory leak when using mupdf-rs:

Open RikaKit opened this issue 1 year ago • 2 comments

After completing the work of extracting the image from the document mupdf should free up used memory, but mupdf does not release the used memory, With each image extracted, memory consumption increases.

Here is a demo code to reproduce the problem: test_mupdf_memory_leak.rs.txt

RikaKit avatar May 28 '24 17:05 RikaKit

I also noticed what I think is an instance of a memory leak in this library, specifically here in src/page.rs. It looks like the FFI layer transfers ownership of a slice to the rust layer, but the rust layer just reads it then copies it over elsewhere (thus leaving the slice leaked).

I think that #108 could help with this, and I'd be happy to help tackle these leaks once that is settled.

itsjunetime avatar Feb 10 '25 20:02 itsjunetime

Pull requests are welcome!

messense avatar Feb 11 '25 02:02 messense