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

Memory alignment in src::fib::chain::Node cannot be guaranteed #15

Open
qiuchengxuan opened this issue Apr 23, 2021 · 0 comments
Open

Comments

@qiuchengxuan
Copy link

qiuchengxuan commented Apr 23, 2021

#[repr(C)]                                                                                                                                     
pub struct Node<F> {                                                                                                                           
    advance: unsafe fn(*mut ListNode<Node<()>>) -> bool,                                                                                       
    deallocate: unsafe fn(*mut ListNode<Node<()>>),                                                                                            
    fib: F,                                                                                                                                    
}

Since F here is a closure which memory alignment is uncertain, fib should be boxed or by other means to avoid unexpected memory align.

@qiuchengxuan qiuchengxuan changed the title Add fib after add exec will cause panic Panic when add fib after add large exec Apr 23, 2021
@qiuchengxuan qiuchengxuan reopened this Apr 23, 2021
@qiuchengxuan qiuchengxuan changed the title Panic when add fib after add large exec A strange hard fault panic Apr 23, 2021
@qiuchengxuan qiuchengxuan changed the title A strange hard fault panic Memory alignment in src::fib::chain::Node cannot be guaranteed Apr 24, 2021
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