retrowin32 icon indicating copy to clipboard operation
retrowin32 copied to clipboard

memory iterator

Open evmar opened this issue 1 year ago • 2 comments

I realized there is a better API for iterating some pod data in memory, and also that iterating while executing x86 code is unsafe because memory could move out from underneath. I think the only ok thing to do here is copy.

CC @encounter

evmar avatar Jul 24 '24 20:07 evmar

(The reason the memory can move is if the call_x86 code eventually allocates more memory, then we resize the underlying Vec<>, which invalidates any pointers into it.)

evmar avatar Jul 24 '24 20:07 evmar

Makes sense to me. Probably the more accurate behavior is to iterate over the address range and read the addr on each iteration (in case call_x86 code modifies the range), but I can't imagine that will ever be an issue.

encounter avatar Jul 24 '24 20:07 encounter