From 469db774371d75cdb031e7d9c892cef0c4a3a068 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Mon, 16 Aug 2021 23:28:33 +0100 Subject: [PATCH] Add allocation example --- agb/examples/allocation.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 agb/examples/allocation.rs diff --git a/agb/examples/allocation.rs b/agb/examples/allocation.rs new file mode 100644 index 00000000..327ed07e --- /dev/null +++ b/agb/examples/allocation.rs @@ -0,0 +1,15 @@ +#![no_std] +#![no_main] + +extern crate agb; +extern crate alloc; + +use alloc::boxed::Box; + +#[agb::entry] +fn main() -> ! { + loop { + let b = Box::new(1); + agb::println!("dynamic allocation made to {:?}", &*b as *const _); + } +}