# The RTHeap interface

`RTHeap` provides access to the layout of data on the heap. heap

storage allocator

allocator

Each referent on the heap, and the heap data record for each object, is represented as a contiguous sequence of ``data bytes''. Referents and data records may also contain other ``non-data'' bytes like headers, method suite pointers, or open array shapes.

See `RTType` for related operations on types.

    INTERFACE RTHeap;

    PROCEDURE GetDataAdr(r: REFANY): ADDRESS;

If `r` is a traced reference, returns the address of `r^`'s data bytes. If `r` is a traced object, returns the address of the bytes of `r`'s data record. It is a checked runtime error if `r` is `NIL`. Note that the address can subsequently change unless object mobility is disabled using `RTCollector`.

    PROCEDURE GetDataSize(r: REFANY): CARDINAL;

If `r` is a traced reference, returns the number of `r^`'s data bytes. If `r` is a traced object, returns the number of bytes of `r`'s data record. It is a checked runtime error if `r` is `NIL`.

    PROCEDURE GetArrayShape(r: REFANY; VAR s: ARRAY OF INTEGER);

If `r` is a traced reference to an open array, returns in `s[0 .. n-1]` the size of each dimension of the n-dimensional open array `r^`. If `s` is too large, the extra elements are ignored; if it's too small, the extra sizes are discarded. It is a checked runtime error if `r` is `NIL`. If `r` is not a reference to an open array, `s` is unchanged.

    END RTHeap.