You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rescoped under #38 (unified multi-metric memory model). This is the isolated heap
mode — i.e. running the memray pass in a subprocess for an order-independent baseline. It
reuses #38/#34's shared fork+wait4+gc.freeze()+baseline machinery rather than its own;
this issue is just the heap-specific surfacing of it. Original proposal below.
Found wiring pytest-benchmem into linopy's benchmark suite.
In-process measurement is fine generally, but linopy builds models via solvers with C-level allocations that aren't always freed between tests in one process — so a peak can be influenced by earlier tests. linopy's old engine ran each phase in its own subprocess for a clean baseline.
Proposed
Add --benchmark-memory-isolate (and a matching fixture/option) that runs each measured action's memray pass in a forked/spawned subprocess and returns the peak — a clean baseline per measurement. In-process stays the default.
Acceptance
With the flag, each measurement runs in its own process; peaks are independent of test order.
Without it, behavior is unchanged.
Notes
Action must be forkable (posix fork is simplest; document the spawn/pickle caveat).
Pairs with --benchmark-memory-repeats.
Need: accuracy for native-allocation libraries without forcing subprocess cost on every consumer.
🤖 Issue drafted by Claude from the linopy integration.
Note
Rescoped under #38 (unified multi-metric memory model). This is the isolated
heapmode — i.e. running the memray pass in a subprocess for an order-independent baseline. It
reuses #38/#34's shared
fork+wait4+gc.freeze()+baseline machinery rather than its own;this issue is just the
heap-specific surfacing of it. Original proposal below.In-process measurement is fine generally, but linopy builds models via solvers with C-level allocations that aren't always freed between tests in one process — so a peak can be influenced by earlier tests. linopy's old engine ran each phase in its own subprocess for a clean baseline.
Proposed
Add
--benchmark-memory-isolate(and a matching fixture/option) that runs each measured action's memray pass in a forked/spawned subprocess and returns the peak — a clean baseline per measurement. In-process stays the default.Acceptance
Notes
forkis simplest; document thespawn/pickle caveat).--benchmark-memory-repeats.Need: accuracy for native-allocation libraries without forcing subprocess cost on every consumer.
🤖 Issue drafted by Claude from the linopy integration.