package layoutgraph

import 

const maxPooledOverlapExceptions = 4096

type overlapExceptionScratch struct {
	nodes map[*Node]struct{}
}

var overlapExceptionPool = typedpool.New(func() *overlapExceptionScratch {
	return new(overlapExceptionScratch)
})

// Container transactions repeatedly validate the same descendant exceptions.
// Retain bounded map storage across checks, while releasing every graph pointer
// on success, cancellation, resource failure, or panic.
func releaseOverlapExceptions( *overlapExceptionScratch) {
	if len(.nodes) > maxPooledOverlapExceptions {
		.nodes = nil
	} else {
		clear(.nodes)
	}
	overlapExceptionPool.Put()
}