Crate oxc_allocator

Crate oxc_allocator 

Source
Expand description

§⚓ Oxc Memory Allocator

Oxc uses a bump-based memory arena for faster AST allocations.

This crate contains an Allocator for creating such arenas, as well as ports of data types from std adapted to use this arena:

See Allocator docs for information on efficient use of Allocator.

§Features

  • serialize - Enables serialization support for Box and Vec with serde and oxc_estree.

  • pool - Enables [AllocatorPool].

  • bitset - Enables [BitSet].

  • from_raw_parts - Adds [Allocator::from_raw_parts] method. Usage of this feature is not advisable, and it will be removed as soon as we’re able to.

  • fixed_size - Makes [AllocatorPool] create large fixed-size allocators, instead of flexibly-sized ones. Only supported on 64-bit little-endian platforms at present. Usage of this feature is not advisable, and it will be removed as soon as we’re able to.

  • track_allocations - Count allocations and reallocations. For internal use only. The APIs provided by this feature are sketchy at best, and possibly undefined behavior. Do not enable this feature under any circumstances in production code.

  • disable_track_allocations - Disables track_allocations feature. Purpose is to prevent --all-features enabling allocation tracking.

Re-exports§

pub use hash_map::HashMap;

Modules§

hash_map
A hash map without Drop, that uses FxHasher to hash keys, and stores data in arena allocator.

Structs§

Address
Memory address of an AST node in arena.
Allocator
A bump-allocated memory arena.
Box
A Box without Drop, which stores its data in the arena allocator.
StringBuilder
String builder.
Vec
A Vec without Drop, which stores its data in the arena allocator.

Traits§

AllocatorAccessor
Accessor for getting the underlying allocator.
CloneIn
A trait to explicitly clone an object into an arena allocator.
Dummy
A trait to create a dummy AST node.
FromIn
This trait works similarly to the standard library From trait.
GetAddress
Trait for getting the memory address of an AST node.
IntoIn
This trait works similarly to the standard library Into trait. It is similar to FromIn is reflective, A FromIn implementation also implicitly implements IntoIn for the opposite type.
TakeIn
A trait to replace an existing AST node with a dummy.