zkopru-network / zkopru

Ethereum L2 scaling solution for private transactions using zk-SNARK and optimistic rollup.
https://zkopru.network
GNU General Public License v3.0
216 stars 28 forks source link

Memory leak in web3 contracts #135

Open chancehudson opened 3 years ago

chancehudson commented 3 years ago

Describe the bug Web3 contract creation has a memory leak as described here. I've encountered this issue in other codebases that create contracts objects frequently.

The pattern used here should be replaced by a singleton type pattern that either creates the contract object or retrieves an in memory copy of the contract object.

In long running processes (like a coordinator) frequent requests to static functions retrieving a contract instance (like in a Worker) will cause a memory leak and eventual OOM crash.

wanseob commented 3 years ago

This will be closed when this issue is fixed https://github.com/ChainSafe/web3.js/pull/3866