Struct comet::heap::Heap[][src]

#[repr(C)]
pub struct Heap { /* fields omitted */ }
Expand description

Comet heap. It stores all the required global data:

  • GlobalAllocator instance
  • Callbacks that are run before GC cycle
  • Threshold and allocations of current GC cycle
  • Number of deferred GC cycles
  • Weak references

Implementations

This function will iterate through each object allocated in heap. Separate callbacks are used for weak refs and regular objects.

NOTE: callback for regular object might receive weak ref pointer in it too.

Adds GC constraint into constraints vector. Each constraint is ran before GC cycle.

Adds core GC constraints into constraint vector. For now it is just conservative stack marking constraint.

Creates new heap instance with configuration from config.

Force collect garbage. If GC is deferred nothing will happen.

Collects garbage if necessary i.e allocates bytes are greater than threshold.

Allocate weak reference for specified GC pointer.

Allocate “raw” memory. This memory is not initialized at all (except header part of UntypedGcRef).

  • size should include size for object you’re allocating and additional bytes for HeapObjectHeader. If it is embedded in your struct as first field you do not have to include that.
  • index should be an index obtained by calling T::index() on type that implements GCInfoTrait

This function returns none if allocation is failed.

Same as Heap::allocate_raw except it will try to perform GC cycle and if GC does not free enough memory it will abort.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.