Am 16.09.20 um 00:47 schrieb Richard Henderson: > On 9/15/20 10:46 AM, Richard Henderson wrote: >> We already have a function that can alloc with alignment, >> but we need to pass this down from the structure. We also >> don't want to use this function unconditionally, because >> the windows version does page allocation, which would be >> overkill for the vast majority of the objects allocated. > Stefan, why are we using VirtualAlloc in util/oslib-win32.c, > qemu_try_memalign, > instead of _aligned_malloc?
I think we use it because Fabrice introduced VirtualAlloc in commit 6e4255f6a65091fbe7d17bfda546e2aa1b72f9a6 (with a comment "FIXME: this is not exactly optimal solution [...]"). Maybe there was no _aligned_malloc available 15 years ago. Commit 33f002714be2ed58ed05ae3870d5ea6915df4b47 then reused VirtualAlloc for qemu_try_memalign (without a FIXME comment). Obviously nobody cared to find a better solution until now. Stefan