Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find a way to better manage Disposable(Array Pool List) Entities. #7481

Open
obasekiosa opened this issue Sep 23, 2024 · 1 comment
Open

Comments

@obasekiosa
Copy link
Contributor

Description
This is more of a ux/optimazation issue.

Right now Disposable (Array Pool List) entities in the code base are disposed/handled based on the discretion of the dev.
It is very easy to forget or mishandle a disposable object(entity), either by multiple dispose, or forgetting to dispose without any feedback/warning.
Its basically left to the user to be careful in memory management, especially for cases of nested calls, creation of managed memory deep within the call stack but returned, made use of and disposed at a much higher point in the stack.

Disposable objects, make use of memory pools which need to be returned to the pool after usage.
The difficulty is knowing when to return, especially if the object is created and then passed(owned) by a different object.
This behavior is quite similar to rusts idea of ownership and memory management.

Maybe there's a solution along those lines ?

Actual behavior
Running all Nethermind tests locally and in parallel seems to cause

Exit code is 134 (Unhandled exception. System.InvalidOperationException: ArrayPoolList hasn't been disposed. Created    at Nethermind.Core.Collections...

Expected behavior
ArrayPools should be easier to properly disposed/managed.
Hence making it simpler to spot cases where the above error might happen or impossible to happen?

@obasekiosa obasekiosa changed the title Find a way to better manage Disposable Entities. Find a way to better manage Disposable(Array Pool List) Entities. Sep 23, 2024
@emlautarom1
Copy link
Contributor

This has been an issue for some time now. See:

The current workaround is to run the full test suite in Release config like we do on CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants