Skip to content

Does not honor alignment reliably #87

@MageSlayer

Description

@MageSlayer

Hi

Following example reliably fails on mimalloc-0.1.32.
Crash is always at 4096 alignment.

 #[test]                                                                                                                                                                                                                                     
    fn test1() { ▶️ Run Test|Debug                                                                                                                                                                                                           
        for i in 0..1000 {                                                                                                                                                                                                                      
            let size = 4096;                                                                                                                                                                                                                    
            let align = 1 << (i % 16);                                                                                                                                                                                                          
            let ptr = unsafe {                                                                                                                                                                                                                  
                std::alloc::alloc(std::alloc::Layout::from_size_align_unchecked(size, align))                                                                                                                                                   
            };                                                                                                                                                                                                                                  
            assert!(!ptr.is_null());                                                                                                                                                                                                            
            assert!((ptr as usize) % align == 0, "Align {} {}", i, align);                                                                                                                                                                      
        }                                                                                                                                                                                                                                       
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions