-
-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add better cursor support in stack allocators #1012
Add better cursor support in stack allocators #1012
Conversation
…rest of api tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Very nice refactor to return the cursor pointer. Much less bookkeeping.
I can't hit the "Approve", but I approve these changes!
@@ -841,6 +841,8 @@ ecs_iter_t ecs_page_iter( | |||
ecs_check(it->next != NULL, ECS_INVALID_PARAMETER, NULL); | |||
|
|||
ecs_iter_t result = *it; | |||
result.priv.cache.stack_cursor = NULL; /* Don't copy allocator cursor */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. These were the places where I ran into issues with storing pointers. Glad you had the context to know what was expected of the wrapper iterator!
This PR fixes a bug in the stack allocator that can cause memory corruption in scenarios where multiple (nested) iterators are iterated.
=== Original message ===
This PR is to fix some tests that have errors hidden by a large bug. These test cases were not properly finishing iteration, nor calling
ecs_iter_fini()
. Furthermore, there are cases of overlapping lifetimes of objects allocated on the stack allocator.The test failures in subsequent CI runs shows the errors found be adding consistency checks to the stack allocator. Then as the new tracking of freed data improved, and fixes in some test cases, the CI errors were eliminated over time.
The existing test cases exercised the various lifetime issues that the new tracking is designed to support. Behavior of the allocator is:
The first commit intentionally has the fixes commented out and additional checks to confirm that the iterator is finished. This first commit will therefore fail CI tests a total of 7 failures.The second commit will show these are fixed.