-
Notifications
You must be signed in to change notification settings - Fork 115
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
Prevent corruption of memory cache #1136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we try to trim down @ftalbrecht's example code that exhibited the error and add it as a test case?
@renefritze, the Enforce PR labels thing is failing again. We had similar issues some time ago. Maybe we should disable it? |
Codecov Report
|
Lets see if the update fixing the run first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no better suggestion than deep copy, looks good.
This PR changes the behavior of
MemoryRegion
to always make adeepcopy
of any values stored in the cache and to only return deep copies of the values contained in the cache. While this may increase the memory footprint and somewhat hurt performance, it seems like the only way to make usingMemoryRegion
really safe. The practical impact of the increased memory usage should be quite small, IMHO.Note that the current provisions of returning copies of
VectorArrays
and making NumPy arrays immutable had no effect since all values stored in the cache are actually 2-tuples.See #1133 for a non-obvious real world example of
MemoryRegion
being corrupted.