-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix wasm memory bug #2066
Fix wasm memory bug #2066
Conversation
runtime::MemoryConfig config{kDefaultHeapBase, {}}; | ||
auto handle = std::make_shared<MemoryImpl>(rei_->getMemory(), config); | ||
auto allocator = | ||
std::make_unique<runtime::MemoryAllocatorImpl>(handle, config); | ||
allocator_ = allocator.get(); | ||
memory_ = std::make_unique<runtime::Memory>(handle, std::move(allocator)); |
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.
How about combine calls for Memory assemble into single free-function?
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 thought about it, but in the end it didn't seem to be very useful, as it would eliminate just a couple of simple lines of code that create allocator across the entire code base.
@@ -68,7 +85,7 @@ namespace kagome::runtime { | |||
std::optional<uint32_t> readFree(WasmPointer ptr) const; | |||
|
|||
private: | |||
Memory &memory_; | |||
std::shared_ptr<MemoryHandle> memory_; |
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.
Rust passes Memory &
to each allocate
/deallocate
call
Referenced issues
Description of the Change
Clang-15's TSAN doesn't work on new linux kernels.
Runtime Memory had a nasty circular dependency on a memory allocator, which is refactored here.
Possible Drawbacks
Checklist Before Opening a PR
Before you open a Pull Request (PR), please make sure you've completed the following steps and confirm by answering 'Yes' to each item: