Skip to main content

alloc

Function alloc 

Source
pub fn alloc(template: ClassTemplateId, field_words: usize) -> u64
Expand description

Allocates a new object of template with field_words words of zero-initialized field storage, refcount 1. §1.1’s target signature takes layout: &ObjectLayout instead of a bare word count — ObjectLayout does not exist until Task 5, so this task takes the one piece of it alloc itself actually needs; Task 5 adapts call sites to pass layout.total_words() (or equivalent) once that type exists, with no further change to this function’s behavior.