Skip to content

Conversation

@Robert-M-Lucas
Copy link

BumpAllocator currently passes many_boxes_long_lived in release mode due to long_lived and the assert_eq being optimised away. Testing in release mode can be useful as it can make tests run faster overall, despite the longer compile time per test and ensures correct functionality when debug code isn't included.

@matveitolochko
Copy link

Is BumpAllocator supposed to fail many_boxes_long_lived in debug mode ?
If so, then shouldn't the test be annotated as such ?
And if not, then is there any evidence that long_lived gets optimized away ?

@Robert-M-Lucas
Copy link
Author

@AtomicGamer9523 The BumpAllocator is meant to fail many_boxes_long_lived (as it does in debug mode when you are going through the tutorial) as long_lived prevents any freeing which it does not do in release mode with cargo test --release. While it is not the final allocator used, the BumpAllocator remains in the source code and its passing of this test shows that the test does not correctly test other allocators in release mode, something that I found useful to run tests faster (particularly when increasing the heap size).

@matveitolochko
Copy link

Interesting, my main concern with black_box is this. There must be a better way to tell the compiler to not optimize out long_lived.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants