Skip to content

JsonSchemaResultsCollector.CreateUnrented Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: JsonSchemaResultsCollector.cs

CreateUnrented(JsonSchemaResultsLevel, int)

Creates a non-pooled JSON schema results collector for standalone or specialized usage scenarios.

public static JsonSchemaResultsCollector CreateUnrented(JsonSchemaResultsLevel level, int estimatedCapacity)

Parameters

Name Type Description
level JsonSchemaResultsLevel Controls result verbosity and collection overhead.
estimatedCapacity int Expected number of validation results for buffer pre-sizing. (optional)

Returns

JsonSchemaResultsCollector

A standalone JsonSchemaResultsCollector instance that is not managed by the thread-local pool. Resources are released directly on disposal without pool interaction.

Remarks

Use Cases: - Long-lived Instances: When the collector lifetime exceeds typical validation scope - Memory Isolation: When pool interaction is undesirable for security or debugging - Testing: When predictable memory behavior is required for unit tests - Single-use: When validation frequency doesn't justify pooling overhead Performance Considerations: Non-pooled instances have higher allocation overhead but provide complete memory isolation. Each instance allocates fresh buffers from ArrayPool and returns them directly on disposal. Use when pool interaction is problematic or when instance lifetime is unpredictable.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue