-
Notifications
You must be signed in to change notification settings - Fork 66
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
Call Collection::out_of_memory if the allocation size is larger than max heap size #896
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.
See in-line comments. We probably can't let the VM recover from OOM for now. For the test case, maybe catch_unwind
can be used to prevent the lock from being poisoned.
* Use catch/resume_rewind to avoid poison lock for SerialFixture. * Rename oom_size_check to will_go_oom_on_acquire, and return a boolean. * Add another test that is ignored.
There is an issue with this PR: if we try to do any address arithmetic in the allocation fastpath, we may have overflow in the computation, and we do not call mmtk-core/vmbindings/dummyvm/src/tests/issue867_allocate_unrealistically_large_object.rs Line 27 in 04c0c48
|
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.
LGTM
One alternative, although I don't know how feasible it is, would be to register a custom panic handler and then call either |
I think doing checking in Rust is OK. The "real" fast path should be implemented by the JIT compiler, or inlined to the concrete allocation sites. In most of the cases, the object size should be a constant, and doesn't need checking anyway, given that a bump-pointer allocator always checks against a reaonably-sized |
In the case of a VM implemented in Rust, this is not necessarily true. It would be inlined by PGO |
That makes sense. But if that's the case, the compiler can still eliminate the object size check if the supplied object size is a constant, although I am not 100% confident that the compiler will do it. |
Often a "checked" and "unchecked" API is presented to a developer. They are recommended to use the "checked" one always but they can use the "unchecked" one for more performance, but they have to guarantee that they have checked the assumptions beforehand |
Should we merge this or discuss how to fix the bug Yi noticed? |
I think we can merge this. I will try out the idea of catching Rust panics in a separate PR (I cannot guarantee it would work out though). |
This closes #867.