let mut pids: Vec<u32> = Vec::with_capacity(PID_MAX);
Function allocates (99999 * 4 / 1024) =~ 390kb of space for a buffer which is not that bad by modern standards but still unnecessary because it's possible to retrieve the desired buffer size beforehand by calling proc_listpids in a special way like this:
int numberOfProcesses = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0);
Hey, first of all thanks for the efforts for making this library! I have an optimization idea for
listpids
: https://github.com/andrewdavidmackenzie/libproc-rs/blob/master/src/libproc/proc_pid.rs#L232Function allocates (99999 * 4 / 1024) =~ 390kb of space for a buffer which is not that bad by modern standards but still unnecessary because it's possible to retrieve the desired buffer size beforehand by calling
proc_listpids
in a special way like this:Example code at the bottom of the question: https://stackoverflow.com/q/3018054