wasilibs / wazero-helpers

MIT License
2 stars 1 forks source link

Fix slice allocator to be non-moving and add unit test #2

Closed anuraaga closed 1 month ago

anuraaga commented 1 month ago

I realized I copied sqlite's slice allocator without taking a look at it, in that repo there probably isn't a use case for a non-moving slice allocator, but here we should make sure it behaves the same as the others in case it is used with shared memory.

I also noticed that Reallocate(size) greater than max but less than rounded up to page works. In practice, wazero shouldn't make such a reservation, I think, but it seemed to make sense to preseve those semantics in the allocators as well.

Also fixes windows error handling

ncruces commented 1 month ago

Yes, you're using syscall directly and I missed the difference in error handling done by the x/sys/windows.VirtualAlloc wrapper.