xous: hosted: don't over-allocate memory messages

Call `shrink_to_fit()` on the array that contains memory messages. This
is beacuse we throw away the `capacity` field, and we want to make sure
we can reconstitute the vector at a later stage.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-06-16 18:31:16 +08:00
parent 180c99aa8d
commit 486d993c4c

View file

@ -687,6 +687,8 @@ fn _xous_syscall_result(ret: &mut Result, thread_id: TID, server_connection: &Se
eprintln!("Server shut down: {}", e);
std::process::exit(0);
}
data.shrink_to_fit();
assert_eq!(data.len(), data.capacity());
let len = data.len();
let addr = data.as_mut_ptr();
memory_message.buf.addr = crate::MemoryAddress::new(addr as _).unwrap();