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

thread 'main' has overflowed its stack #8

Open
lijingwei9060 opened this issue Sep 1, 2021 · 0 comments
Open

thread 'main' has overflowed its stack #8

lijingwei9060 opened this issue Sep 1, 2021 · 0 comments

Comments

@lijingwei9060
Copy link

I got panic "thread 'main' has overflowed its stack" when try to run example/wirte-a-lot.

It happened when skipmap dropped.

The default drop of Node is recursive, it has a giant liked-list of nodes. The call back is tool large .

The following works.

impl Drop for Node {
    fn drop(&mut self) {
        // large object should drop
        if let Some(mut next) = self.next.take() {
            while let Some(child) = next.next.take() {
                next = child;
            }
        }
        unsafe {
            for skip in self.skips.iter_mut() {
                if let Some(mut next) = skip.take() {
                    while let Some(child) = (*next).next.take() {
                        next = Box::into_raw(child);
                    }
                }
            }
        }
    }
}
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

No branches or pull requests

1 participant