# Underrust: What does vec!\[0u8; 1024\] really do?

DevFeed: [Underrust: What does vec!\[0u8; 1024\] really do?](<https://devfeed.tech/articles/underrust-what-does-vec-0u8-1024-really-do-35464.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/rust-zeroed-vector-allocation/>)

Author: Graham King

Published: 2024-03-29T15:00:00Z

Content type: article

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [cpu](<https://devfeed.tech/topics/cpu.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [glibc](<https://devfeed.tech/tags/glibc.md>), [linux](<https://devfeed.tech/tags/linux.md>), [memory](<https://devfeed.tech/tags/memory.md>), [rust](<https://devfeed.tech/tags/rust.md>), [software](<https://devfeed.tech/tags/software.md>), [underrust](<https://devfeed.tech/tags/underrust.md>), [x86](<https://devfeed.tech/tags/x86.md>)

## AI overview

This article traces how Rust creates a zero-initialized vector, following the allocation path through Rust's allocator, the platform abstraction layer, libc's calloc, and the Linux kernel. It examines allocation behavior and cost, with examples focused on 64-bit Linux, glibc, and an Intel Tiger Lake CPU.

## Source excerpt

How does Rust allocate a zeroed Vec and what does it cost?