Browse Source

win-capture: Use better defaults in thread_is_suspended

On my system with ~250 processes running, this loop has to run over 500
times before allocating enough memory. Use better initial and increment
values to avoid thrashing the heap.
Richard Stanway 4 years ago
parent
commit
320177926d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      plugins/win-capture/nt-stuff.c

+ 2 - 2
plugins/win-capture/nt-stuff.c

@@ -156,7 +156,7 @@ NTSTATUS nt_query_information(SYSTEM_INFORMATION_CLASS info_class, PVOID info,
 
 bool thread_is_suspended(DWORD process_id, DWORD thread_id)
 {
-	ULONG size = 4096;
+	ULONG size = 524288;
 	bool suspended = false;
 	void *data = malloc(size);
 	if (!data)
@@ -173,7 +173,7 @@ bool thread_is_suspended(DWORD process_id, DWORD thread_id)
 		}
 
 		free(data);
-		size += 1024;
+		size += 524288;
 		data = malloc(size);
 		if (!data)
 			return false;