diff --git a/atomics-contract/src/main.rs b/atomics-contract/src/main.rs index 92b99e2..c76b04b 100644 --- a/atomics-contract/src/main.rs +++ b/atomics-contract/src/main.rs @@ -4,12 +4,15 @@ #[cfg(test)] extern crate alloc; -#[cfg(not(test))] -use ckb_std::default_alloc; #[cfg(not(test))] ckb_std::entry!(program_entry); -#[cfg(not(test))] -default_alloc!(); +// By default, the following heap configuration is used: +// * 16KB fixed heap +// * 1.2MB(rounded up to be 16-byte aligned) dynamic heap +// * Minimal memory block in dynamic heap is 64 bytes +// For more details, please refer to ckb-std's default_alloc macro +// and the buddy-alloc alloc implementation. +ckb_std::default_alloc!(16384, 1258306, 64); pub fn program_entry() -> i8 { log::error!("Just a log line"); diff --git a/contract/src/main.rs b/contract/src/main.rs index dedabe3..db5049e 100644 --- a/contract/src/main.rs +++ b/contract/src/main.rs @@ -7,7 +7,13 @@ extern crate alloc; #[cfg(not(any(feature = "native-simulator", test)))] ckb_std::entry!(program_entry); #[cfg(not(any(feature = "native-simulator", test)))] -ckb_std::default_alloc!(); +// By default, the following heap configuration is used: +// * 16KB fixed heap +// * 1.2MB(rounded up to be 16-byte aligned) dynamic heap +// * Minimal memory block in dynamic heap is 64 bytes +// For more details, please refer to ckb-std's default_alloc macro +// and the buddy-alloc alloc implementation. +ckb_std::default_alloc!(16384, 1258306, 64); pub fn program_entry() -> i8 { ckb_std::debug!("This is a sample contract!"); diff --git a/stack-reorder-contract/src/main.rs b/stack-reorder-contract/src/main.rs index 93a65a6..e9e6798 100644 --- a/stack-reorder-contract/src/main.rs +++ b/stack-reorder-contract/src/main.rs @@ -4,12 +4,15 @@ #[cfg(test)] extern crate alloc; -#[cfg(not(test))] -use ckb_std::default_alloc; #[cfg(not(test))] ckb_std::entry!(program_entry); -#[cfg(not(test))] -default_alloc!(); +// By default, the following heap configuration is used: +// * 16KB fixed heap +// * 1.2MB(rounded up to be 16-byte aligned) dynamic heap +// * Minimal memory block in dynamic heap is 64 bytes +// For more details, please refer to ckb-std's default_alloc macro +// and the buddy-alloc alloc implementation. +ckb_std::default_alloc!(16384, 1258306, 64); #[allow(unused_variables, unused_assignments)] pub fn program_entry() -> i8 { diff --git a/standalone-contract/src/main.rs b/standalone-contract/src/main.rs index bf6e0c7..f6057e1 100644 --- a/standalone-contract/src/main.rs +++ b/standalone-contract/src/main.rs @@ -7,12 +7,16 @@ extern crate alloc; #[cfg(test)] mod tests; -#[cfg(not(test))] -use ckb_std::default_alloc; #[cfg(not(test))] ckb_std::entry!(program_entry); #[cfg(not(test))] -default_alloc!(); +// By default, the following heap configuration is used: +// * 16KB fixed heap +// * 1.2MB(rounded up to be 16-byte aligned) dynamic heap +// * Minimal memory block in dynamic heap is 64 bytes +// For more details, please refer to ckb-std's default_alloc macro +// and the buddy-alloc alloc implementation. +ckb_std::default_alloc!(16384, 1258306, 64); pub fn program_entry() -> i8 { ckb_std::debug!("This is a sample contract!");