From 79cb4cd98219a2bbe065757cff5a8b3aa3e1307a Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 27 Jun 2022 04:03:49 +0800 Subject: [PATCH] image display now works, once heap increase is called takes about 1MiB of heap to decode the test PNG. Putting the heap increase at boot seems to not work, it causes other processes to not spawn. The condition is not terribly reproducible, so it's probably a concurrency issue of some type. --- services/shellchat/src/cmds/net_cmd.rs | 21 ++++++++++++++++++++- services/shellchat/src/main.rs | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/services/shellchat/src/cmds/net_cmd.rs b/services/shellchat/src/cmds/net_cmd.rs index 972256cbd..ac3cfa45f 100644 --- a/services/shellchat/src/cmds/net_cmd.rs +++ b/services/shellchat/src/cmds/net_cmd.rs @@ -289,6 +289,25 @@ impl<'a> ShellCmdApi<'a> for NetCmd { } #[cfg(feature="ditherpunk")] "image" => { + let new_limit = 2048 * 1024; + let result = xous::rsyscall(xous::SysCall::AdjustProcessLimit( + xous::Limits::HeapMaximum as usize, + 0, + new_limit, + )); + + if let Ok(xous::Result::Scalar2(1, current_limit)) = result { + xous::rsyscall(xous::SysCall::AdjustProcessLimit( + xous::Limits::HeapMaximum as usize, + current_limit, + new_limit, + )) + .unwrap(); + log::info!("Our new heap is: {}", new_limit); + } else { + panic!("Unsupported syscall!"); + } + #[cfg(feature="tracking-alloc")] use tracking_allocator::{ AllocationGroupToken, AllocationRegistry, @@ -360,7 +379,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd { } else { if len < last_chunk { log::info!("heuristic termination of read loop"); - // break; + break; } } }, diff --git a/services/shellchat/src/main.rs b/services/shellchat/src/main.rs index 20ede01a6..50ca84ef3 100644 --- a/services/shellchat/src/main.rs +++ b/services/shellchat/src/main.rs @@ -362,7 +362,7 @@ fn main () -> ! { wrapped_main(); #[cfg(feature="ditherpunk")] - let stack_size = 1024 * 1024; + let stack_size = 2048 * 1024; #[cfg(feature="ditherpunk")] std::thread::Builder::new() .stack_size(stack_size)