V8: cppgc::AdditionalBytes Struct Reference (original) (raw)

Passed to MakeGarbageCollected to specify how many bytes should be appended to the allocated object.

Example:

class InlinedArray final : public GarbageCollected {

public:

explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}

void Trace(Visitor*) const {}

size_t size;

char* byte_array;

};

for (size_t i = 0; i < 4; i++) {

Process(inlined_array->byte_array[i]);

}

Definition: garbage-collected.h:53

T * MakeGarbageCollected(AllocationHandle &handle, Args &&... args)

Definition: allocation.h:275

constexpr AdditionalBytes(size_t bytes)

Definition: allocation.h:218