zakarumych / gpu-alloc

Implementation agnostic memory allocator for Vulkan-like APIs
Other
86 stars 18 forks source link

Fix freelist #45

Closed zakarumych closed 3 years ago

VincentJousse commented 3 years ago

I still get a second memory allocation that should not happen, even with the just pushed commit.

zakarumych commented 3 years ago

Did you enable "freelist" feature?

VincentJousse commented 3 years ago

My bad, no more avoidable allocations here, good job !! However, I get panicked at 'attempt to subtract with overflow', gpu-alloc/src/freelist.rs:177:21 when I close my window.

zakarumych commented 3 years ago

Right. I've copied a piece of code where return statements prevented block size to be added to total field. Should be fixed now

VincentJousse commented 3 years ago

I still get the panic (at line 175).

VincentJousse commented 3 years ago

Great job !! Sounds good here !!

VincentJousse commented 3 years ago

This is needed to fix gfx-rs/wgpu#1242. Will you release a new version soon ?

zakarumych commented 3 years ago

Thanks for providing test case.

kvark commented 3 years ago

It's scary to see how much this PR was changing in flight. This crate needs more tests, fuzzying, and other means of ensuring correctness.

zakarumych commented 3 years ago

@kvark I totally agree with you. There's few simple tests, but they are clearly not enough.

The code is self-checking with debug assertions everywhere, but this particular field I was struggling with is used as a hint and it's hard to check its value for validity (except counting all free blocks in array).

But better tests are nice to have. It would be great if you could provide some input on how they could be made.