Closed Robbepop closed 2 years ago
Closed as my misunderstanding was with the alloc_at
function since I thought it allows for resizing the virtually allocated memory which it does not. For this we'd need support for mremap
on unix, however, to my knowledge there is no dedicated Windows API for resizing virtual memories which is probably why this crate does not support it.
First of all: Nice crate and API!
I am trying to use your
region
crate in order to efficiently model virtual memory for my virtual machine: https://github.com/Robbepop/runwellThe crate's docs are telling about issues with multiple threads but gave no suggestion in how to operate in that environment properly: https://docs.rs/region/3.0.0/region/#parallelism
For my project I have this thin-wrapper for
region::Allocation
: https://github.com/Robbepop/runwell/blob/master/crates/vmem/src/lib.rs ... and some unit tests on top: https://github.com/Robbepop/runwell/blob/master/crates/vmem/src/tests.rsUsing
cargo test --package runwell_vmem
results in 3 different scenarios:Bug 2: Cannot Allocate Memory (~5%)
Using
cargo test --package runwell_vmem -- --test-threads 1
solves the problem. So it is pretty clear that the concurrently running test threads are kinda having conflicts with each other.From the Rust point of view those tests do not have shared data and yet they compromise each other. I am sure I have some misconception or misunderstanding about the underlying APIs.
I was trying to remove as many of the unit tests to see which minimum subset still triggers the above bugs: At minimum the
grow_to_capacity_works
,grow_works
,read_write_works
unit tests need to be run.Please help to resolve my misconceptions about this crate and its invariants and ideally help me on track so that I can actually use this nice API of yours. :)