Skip to content

Instantiating the array via default seems to have a very large stack footprint #108

@prestwich

Description

@prestwich

May be misunderstanding something here, but it looks like the instantiation process has an unnecessarily heavy stack footprint. I expect to have a few MB of stack space available, but can't instantiate an array of size larger than ~200kB.

#[cfg(test)]
mod test {
    #[test]
    fn it_defaults() {
        // 208896
        dbg!(std::mem::size_of::<GenericArray<[u64; 32], U816>>());
        // 209152
        dbg!(std::mem::size_of::<GenericArray<[u64; 32], U817>>());
        
        // Works
        GenericArray::<[u64; 32], U816>::default();
        
        // Stack Overflow
        GenericArray::<[u64; 32], U817>::default();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions