ortex icon indicating copy to clipboard operation
ortex copied to clipboard

Memory leak

Open m0rt3nlund opened this issue 7 months ago • 3 comments

Hi!

I am running a YOLO model on my Windows machine and I am having a very big memory leak that I have sourced down to the ortex library.

I am currently sending it an NX tensor (Torchx.Backend) as an input and I have removed all other code around it to make sure it is the actual running of the model that is the problem.

Below is a screenshot of my virtual memory growing steadly when the model is ran once each second.

Image

Since I am running on Windows I cannot use valgrind or similar tools, and drMemory is also not working properly.

Is this a known problem with ortex or ort?

I assumed the resource handler in erlang was supposed to dealloc the resources that are shared between erlang and rustler?

Thanks!

m0rt3nlund avatar Jul 09 '25 08:07 m0rt3nlund

Trying to compile and run under WSL with Valgrind now.

m0rt3nlund avatar Jul 09 '25 13:07 m0rt3nlund

Interesting, thanks for opening this. You're correct, the Erlang garbage collection should be deallocating the memory when its reference count goes to 0. Do you have the test code that's causing memory growth? Sounds like something may be keeping a reference around. In general we haven't tested much on Windows so if there's something Windows specific to this issue I'm afraid I won't be of much help.

mortont avatar Jul 10 '25 15:07 mortont

I experience the exact same for Ubuntu. Tried using Valgrind for my complete application but i do not think i will live long enough for it to complete execution 🫠 I will try to make minimal viable application to reproduce the problem! :)

m0rt3nlund avatar Jul 10 '25 21:07 m0rt3nlund