MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestQueryWorkingSetPoolExhaustion

Function TestQueryWorkingSetPoolExhaustion

pkg/util/va/ws_test.go:399–424  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

397}
398
399func TestQueryWorkingSetPoolExhaustion(t *testing.T) {
400 // create a tiny pool and exhaust it
401 tiny, err := newPool(1)
402 if err != nil {
403 t.Fatalf("newPool failed: %v", err)
404 }
405 defer tiny.close()
406
407 saved := p
408 p = tiny
409 defer func() { p = saved }()
410
411 // hold the only worker
412 held := tiny.acquire(50 * time.Millisecond)
413 if held == nil {
414 t.Fatal("could not acquire the only worker")
415 }
416 defer tiny.release(held, false)
417
418 // now QueryWorkingSet should fail gracefully
419 ws := []sys.MemoryWorkingSetExInformation{{VirtualAddress: 0x1000}}
420 result := QueryWorkingSet(windows.CurrentProcess(), ws)
421 if result != nil {
422 t.Error("expected nil when pool is exhausted")
423 }
424}
425
426func TestQueryWorkingSetPoolSingletonInit(t *testing.T) {
427 // reset the singleton so poolOnce triggers again

Callers

nothing calls this directly

Calls 6

newPoolFunction · 0.85
acquireMethod · 0.80
releaseMethod · 0.80
QueryWorkingSetFunction · 0.70
closeMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected