You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling eth.contract() frequently and constantly causes memory usage increase a lot.
def contract(self, contract, abi):
start = time.time()
try:
self.api_count_tracking[CONTRACT_CALL] += 1
c = self.w3_client.eth.contract(safe_to_check_sum_address(contract), abi=abi)
end = time.time()
self.time_tracking[CONTRACT_CALL] += end - start
return c
except Exception as e:
logging.error(f'contract not found: contract_address is {contract} error is {e}. abi: {abi}')
end = time.time()
self.time_tracking[CONTRACT_CALL] += end - start
We call this function quite frequently, over 100 times/sec using multithreading and multiprocesses.
I used memory profiler to analyze it and it shows that ContractFactory = ContractFactoryClass.factory(self.w3, **kwargs) was allocated a lot of memory. Another candidate could be venv/lib/python3.9/site-packages/web3/_utils/datatypes.py:61
I found one issue mentioning this problem here: #2296
How can it be fixed?
Not sure how to fix that.
Note: We prefer to use issues to track our work. If you think you've encountered a bug in web3py or
have a feature request, you're in the right place. If you have implementation or usage questions,
please refer to our documentation and/or join the conversation
on discord.
The text was updated successfully, but these errors were encountered:
pip freeze
outputWhat was wrong?
Calling
eth.contract()
frequently and constantly causes memory usage increase a lot.We call this function quite frequently, over 100 times/sec using multithreading and multiprocesses.
I used memory profiler to analyze it and it shows that
ContractFactory = ContractFactoryClass.factory(self.w3, **kwargs)
was allocated a lot of memory. Another candidate could bevenv/lib/python3.9/site-packages/web3/_utils/datatypes.py:61
I found one issue mentioning this problem here: #2296
How can it be fixed?
Not sure how to fix that.
Note: We prefer to use issues to track our work. If you think you've encountered a bug in web3py or
have a feature request, you're in the right place. If you have implementation or usage questions,
please refer to our documentation and/or join the conversation
on discord.
The text was updated successfully, but these errors were encountered: