Messages in this thread | | | Date | Sun, 30 Jul 2023 20:00:33 -0700 | From | Boqun Feng <> | Subject | Re: [PATCH v3 08/13] rust: init: Add functions to create array initializers |
| |
On Sat, Jul 29, 2023 at 09:10:02AM +0000, Benno Lossin wrote: [...] > +/// Initializes an array by initializing each element via the provided initializer. > +/// > +/// # Examples > +/// > +/// ```rust > +/// use kernel::{sync::{Arc, Mutex}, init::pin_init_array_from_fn, new_mutex}; > +/// let array: Arc<[Mutex<usize>; 1_000_000_000]>=
This is nice, but (if I got my math correct) it requires ~30G memory on a 64bit machine, and when this example got generated as a kunit test, my poor VM took forever to finish it ;-) ;-) ;-) Maybe descrease it to, say, 1000?
Regards, Boqun
> +/// Arc::pin_init(pin_init_array_from_fn(|i| new_mutex!(i))).unwrap(); > +/// assert_eq!(array.len(), 1_000_000_000); > +/// ``` [...]
| |