Skip to content
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

Is not safe for SegQueue to keep pushing #1149

Open
zhangzhuang15 opened this issue Nov 21, 2024 · 0 comments
Open

Is not safe for SegQueue to keep pushing #1149

zhangzhuang15 opened this issue Nov 21, 2024 · 0 comments

Comments

@zhangzhuang15
Copy link

In documentation, it says SegQueue is unbounded queue. Let's assume that we have enough memory(memory is really big); if we use SegQueue, and keep pushing, never pop a value, index of tail will increase to the max value of usize type, unfortunately, we continue to push a value, index will be 0 because of usize wrapping_add method, at this moment, index of tail and index of head will bring a problem: SegQueue is empty in is_empty method of SegQueue ! By the way, in practical, memory is not really big as we assumed, and memory exhaustion will come first, as a result, we never see the problem that SegQueue is empty.

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

No branches or pull requests

1 participant