Closed syntrust closed 1 month ago
Actually it was not required to call the Close
method on wazero components as this method only clears caches. All compiled wasm artifacts should be cleaned up by GC. But you have a good point to add this method as other calculator implementations could potentially require the Close
method call to free resources. It could be worked around by instantiating it and call the Close by yourself, but for convenience, I have added the method to Calculator interface and now it calls Close method on the underlying CalculatorImpl if it is has it. It is still optional for CalculatorImpl to implement the Close method. In this case Calculator.Close would do nothing.
I can confirm the memory leak. It turns out resources was not freed acquired by wasm compilation process. It seems was a bug in the wazero module. After upgrading it to the latest version it looks like everything works as expected. @syntrust could you check please that PR #23 works for you?
@olomix Yes that works for me.
Hello, I have followed the usage in the unit test sample
witness/test_wasm_impls/witness_test.go
when usingwazero.NewCircom2WZWitnessCalculator
in my project, and I noticed a continuous increase in memory usage while calculating witnesses usingCalculateWTNSBin
. I am not sure if it is a memory leak but, when I keep the unit test case running with pprof, it seems that the memory usage also increases. Please correct me if I am wrong, but is theClose
method supposed to solve this issue? If so, when and how should it be used? Any feedback would be appreciated.