Giter Club home page Giter Club logo

Comments (6)

q82419 avatar q82419 commented on May 20, 2024 1

I think I can find the reason.
Let me fix on 0.9.0-rc1 in next week. Thanks.

from dapr-wasm.

chenyukang avatar chenyukang commented on May 20, 2024

Thanks @Taction for reporting this issue.
I spent some time to reproduce it, it seems memory does not released after infer processed, here is a sample of memory I got:

image

@juntao Could you let any WasmEdge VM developer to have a look?

Here is the branch I used for testing:
https://github.com/chenyukang/dapr-wasm/tree/debug-mem

Here is the script used to reproduce it: https://github.com/chenyukang/dapr-wasm/blob/debug-mem/image-api-go/run_mem.sh

from dapr-wasm.

juntao avatar juntao commented on May 20, 2024

Thanks. @q82419 Can you look into this? It appears that the TF host function call has a memory leak. Thanks.

from dapr-wasm.

q82419 avatar q82419 commented on May 20, 2024

Hi @chenyukang ,

I think the life-cycle in go may cause memory issue.
It's proper to use conf.Delete() directly after VM creation rather than use defer here,
And use vm.Delete() directly after VM execution rather than use defer here.
And the import objects created here should call the Delete() methods after VM deleted.

For the wasmedge_tensorflow_interface rust crate, I fixed the memory issue in rust and you can use the 0.2.2 version.
But after all, the memory leak in rust which will be compiled into WASM will all disappear after VM deletion.
I've overviewed the WasmEdge-Tensorflow and I cannot find the un-deallocated objects now.
Maybe we can look into and find the reason in the future, and the following graph shows that it's better after the adjustment:

Thanks.

from dapr-wasm.

chenyukang avatar chenyukang commented on May 20, 2024

Hi @chenyukang ,

I think the life-cycle in go may cause memory issue. It's proper to use conf.Delete() directly after VM creation rather than use defer here, And use vm.Delete() directly after VM execution rather than use defer here. And the import objects created here should call the Delete() methods after VM deleted.

For the wasmedge_tensorflow_interface rust crate, I fixed the memory issue in rust and you can use the 0.2.2 version. But after all, the memory leak in rust which will be compiled into WASM will all disappear after VM deletion. I've overviewed the WasmEdge-Tensorflow and I cannot find the un-deallocated objects now. Maybe we can look into and find the reason in the future, and the following graph shows that it's better after the adjustment:

Thanks.

Thanks for investigation, I will update the code as you suggested.
BTW, what is the difference between defer and manually call Delete.
Actually, the original code is Delete, I changed it to defer when debugging the issue.

from dapr-wasm.

alabulei1 avatar alabulei1 commented on May 20, 2024

I closed this issue since pr #20 is merged. Feel free to reopen this issue, if there is anything wrong. @Taction

from dapr-wasm.

Related Issues (13)

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.