#use GPA in freestanding

1 messages · Page 1 of 1 (latest)

lilac nimbus
#

I'm trying to figure out whether it's possible to use a GPA in freestanding. I'm getting errors because the GPA type references std.heap.page_allocator, which doesn't exist in freestanding, as the default backing allocator, even though the only GPA I ever create overrides backing_allocator. It doesn't seem like the default value of that field can be changed by anything in the GPA configuration. Is there any way to work around this?

spark sonnet
#

either: write a page allocator and put it in root.os.heap.page_allocator, or:

pub const os = struct {
  pub const heap = struct {
    pub const page_allocator: Allocator = undefined;
  }
}