Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Require at least 10% GC cleanup
  • Loading branch information
mrousavy committed Mar 3, 2026
commit f1280da655d10207b9a7fcf4fdfac3d6faa6e374
8 changes: 6 additions & 2 deletions example/src/getTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1506,16 +1506,20 @@ export function getTests(

const currentAllocations =
NitroModules.debug_getTotalAllocatedHybridObjects()
const remainingAllocations = currentAllocations - baselineAllocations
// make sure that less than 10% of the total allocations are remaining, indicating GC ran for most of it.
const didDeleteMostObjects =
remainingAllocations < TOTAL_ALLOCATIONS * 0.1
const result: {
baselineAllocations: number
currentAllocations: number
isEqual?: boolean
} = {
baselineAllocations: baselineAllocations,
currentAllocations: currentAllocations,
isEqual: baselineAllocations === currentAllocations,
isEqual: didDeleteMostObjects,
}
if (baselineAllocations !== currentAllocations) {
if (!didDeleteMostObjects) {
delete result.isEqual
}
return result
Expand Down
Loading