Skip to main content

Namespace ServiceStack.Text

Classes​

AssemblyUtils​

Utils to load types

CachedTypeInfo​

CharMemoryExtensions​

Config​

ConvertibleTypeKey​

CsvAttribute​

CsvConfig​

CsvConfig<T>​

CsvReader​

CsvReader<T>​

CsvSerializer​

CsvSerializer<T>​

CsvStreamExtensions​

CsvStringSerializer​

CsvWriter​

CsvWriter<T>​

DateTimeExtensions​

A fast, standards-based, serialization-issue free DateTime serializer.

DefaultMemory​

DirectStreamWriter​

DynamicProxy​

EmitReflectionOptimizer​

EnumInfo​

Env​

EventAttribute​

EventSource​

EventSourceAttribute​

ExpressionReflectionOptimizer​

HttpStatus​

JsConfig​

JsConfig<T>​

JsConfigScope​

JsonArrayObjects​

JsonExtensions​

JsonObject​

JsonSerializer​

Creates an instance of a Type from a string value

JsonSerializer<T>​

JsonStringSerializer​

JsvFormatter​

JsvStringSerializer​

MemoryProvider​

MemoryStreamFactory​

MurmurHash2​

RecyclableMemoryStream​

MemoryStream implementation that deals with pooling and managing memory streams which use potentially large buffers.

This class works in tandem with the RecyclableMemoryStreamManager to supply MemoryStream objects to callers, while avoiding these specific problems:

  1. LOH allocations - since all large buffers are pooled, they will never incur a Gen2 GC
  2. Memory waste - A standard memory stream doubles its size when it runs out of room. This leads to continual memory growth as each stream approaches the maximum allowed size.
  3. Memory copying - Each time a MemoryStream grows, all the bytes are copied into new buffers. This implementation only copies the bytes when GetBuffer is called.
  4. Memory fragmentation - By using homogeneous buffer sizes, it ensures that blocks of memory can be easily reused.

The stream is implemented on top of a series of uniformly-sized blocks. As the stream's length grows, additional blocks are retrieved from the memory manager. It is these blocks that are pooled, not the stream object itself.

The biggest wrinkle in this implementation is when GetBuffer() is called. This requires a single contiguous buffer. If only a single block is in use, then that block is returned. If multiple blocks are in use, we retrieve a larger buffer from the memory manager. These large buffers are also pooled, split by size--they are multiples/exponentials of a chunk size (1 MB by default).

Once a large buffer is assigned to the stream the small blocks are NEVER again used for this stream. All operations take place on the large buffer. The large buffer can be replaced by a larger buffer from the pool as needed. All blocks and large buffers are maintained in the stream until the stream is disposed (unless AggressiveBufferReturn is enabled in the stream manager).

RecyclableMemoryStreamManager​

Manages pools of RecyclableMemoryStream objects.

There are two pools managed in here. The small pool contains same-sized buffers that are handed to streams as they write more data.

For scenarios that need to call GetBuffer(), the large pool contains buffers of various sizes, all multiples/exponentials of LargeBufferMultiple (1 MB by default). They are split by size to avoid overly-wasteful buffer usage. There should be far fewer 8 MB buffers than 1 MB buffers, for example.

RecyclableMemoryStreamManager.Events​

ETW events for RecyclableMemoryStream

ReflectionOptimizer​

RuntimeReflectionOptimizer​

RuntimeSerializableAttribute​

Allow Type to be deserialized into late-bound object Types using __type info

StringBuilderCache​

Reusable StringBuilder ThreadStatic Cache

StringBuilderCacheAlt​

Alternative Reusable StringBuilder ThreadStatic Cache

StringSpanExtensions​

Helpful extensions on ReadOnlySpan<char> Previous extensions on StringSegment available from: https://gist.github.com/mythz/9825689f0db7464d1d541cb62954614c

StringTextExtensions​

StringWriterCache​

Reusable StringWriter ThreadStatic Cache

StringWriterCacheAlt​

Alternative Reusable StringWriter ThreadStatic Cache

SystemTime​

Tracer​

Tracer.ConsoleTracer​

Tracer.NullTracer​

TracerExceptions​

[ TranslateListWithConvertibleElements<TFrom, TTo>](../ServiceStack.Text/TranslateListWithConvertibleElementsTFrom, TTo)​

TranslateListWithElements​

TranslateListWithElements<T>​

TypeConfig<T>​

TypeSerializer​

Creates an instance of a Type from a string value

TypeSerializer<T>​

XmlSerializer​

Structs​

JsonValue​

Interfaces​

IRuntimeSerializable​

Allow Type to be deserialized into late-bound object Types using __type info

IStringSerializer​

ITracer​

ITypeSerializer<T>​

IValueWriter​

Enums​

CsvBehavior​

DateHandler​

EventKeywords​

EventLevel​

ParseAsType​

PropertyConvention​

RecyclableMemoryStreamManager.Events.MemoryStreamBufferType​

Type of buffer

RecyclableMemoryStreamManager.Events.MemoryStreamDiscardReason​

The possible reasons for discarding a buffer

TextCase​

TimeSpanHandler​