Skip to content

Commit bc22bee

Browse files
cgzonesBenBE
authored andcommitted
Darwin: increase buffer size each retry
Increase the buffer for the current running processes each retry to handle very busy systems. Closes: #118
1 parent d58180b commit bc22bee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

darwin/DarwinProcessList.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ static struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count) {
6868
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
6969
struct kinfo_proc* processes = NULL;
7070

71-
for (int retry = 3; retry > 0; retry--) {
71+
for (unsigned int retry = 0; retry < 4; retry++) {
7272
size_t size = 0;
7373
if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0 || size == 0) {
7474
CRT_fatalError("Unable to get size of kproc_infos");
7575
}
7676

77+
size += 16 * retry * retry * sizeof(struct kinfo_proc);
7778
processes = xRealloc(processes, size);
7879

7980
if (sysctl(mib, 4, processes, &size, NULL, 0) == 0) {

0 commit comments

Comments
 (0)