refc_binary.h

Include dependency graph for refc_binary.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="stdbool.h" tooltip="stdbool.h"]
    "8" [label="assert.h" tooltip="assert.h"]
    "11" [label="stdint.h" tooltip="stdint.h"]
    "3" [label="stdlib.h" tooltip="stdlib.h"]
    "13" [label="utils.h" tooltip="utils.h"]
    "7" [label="term_typedef.h" tooltip="term_typedef.h"]
    "14" [label="stddef.h" tooltip="stddef.h"]
    "9" [label="limits.h" tooltip="limits.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" fillcolor="#BFBFBF"]
    "6" [label="erl_nif.h" tooltip="erl_nif.h"]
    "5" [label="resources.h" tooltip="resources.h"]
    "12" [label="memory.h" tooltip="memory.h"]
    "15" [label="stdio.h" tooltip="stdio.h"]
    "10" [label="inttypes.h" tooltip="inttypes.h"]
    "4" [label="list.h" tooltip="list.h"]
    "13" -> "14" [dir=forward tooltip="include"]
    "13" -> "15" [dir=forward tooltip="include"]
    "13" -> "3" [dir=forward tooltip="include"]
    "7" -> "8" [dir=forward tooltip="include"]
    "7" -> "9" [dir=forward tooltip="include"]
    "7" -> "10" [dir=forward tooltip="include"]
    "7" -> "11" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "5" [dir=forward tooltip="include"]
    "6" -> "7" [dir=forward tooltip="include"]
    "5" -> "3" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "5" -> "4" [dir=forward tooltip="include"]
    "5" -> "12" [dir=forward tooltip="include"]
    "12" -> "11" [dir=forward tooltip="include"]
    "12" -> "3" [dir=forward tooltip="include"]
    "12" -> "6" [dir=forward tooltip="include"]
    "12" -> "7" [dir=forward tooltip="include"]
    "12" -> "13" [dir=forward tooltip="include"]
}

This graph shows which files directly or indirectly include refc_binary.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "43" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
    "16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "44" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.h"]
    "10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.c"]
    "9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.h"]
    "30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "46" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "51" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
    "25" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h"]
    "41" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "45" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h"]
    "14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h"]
    "39" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "40" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "52" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h"]
    "32" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "31" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" fillcolor="#BFBFBF"]
    "42" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "50" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
    "49" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
    "28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.h"]
    "12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
    "23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "38" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
    "6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "35" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
    "26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "36" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
    "20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "33" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "34" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "48" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
    "3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "37" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
    "47" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.h"]
    "16" -> "8" [dir=back tooltip="include"]
    "16" -> "17" [dir=back tooltip="include"]
    "16" -> "13" [dir=back tooltip="include"]
    "44" -> "8" [dir=back tooltip="include"]
    "44" -> "14" [dir=back tooltip="include"]
    "44" -> "43" [dir=back tooltip="include"]
    "44" -> "3" [dir=back tooltip="include"]
    "44" -> "13" [dir=back tooltip="include"]
    "44" -> "21" [dir=back tooltip="include"]
    "44" -> "5" [dir=back tooltip="include"]
    "9" -> "10" [dir=back tooltip="include"]
    "9" -> "11" [dir=back tooltip="include"]
    "9" -> "12" [dir=back tooltip="include"]
    "9" -> "13" [dir=back tooltip="include"]
    "30" -> "13" [dir=back tooltip="include"]
    "46" -> "2" [dir=back tooltip="include"]
    "46" -> "13" [dir=back tooltip="include"]
    "46" -> "21" [dir=back tooltip="include"]
    "46" -> "22" [dir=back tooltip="include"]
    "51" -> "8" [dir=back tooltip="include"]
    "51" -> "43" [dir=back tooltip="include"]
    "51" -> "2" [dir=back tooltip="include"]
    "51" -> "12" [dir=back tooltip="include"]
    "51" -> "13" [dir=back tooltip="include"]
    "51" -> "27" [dir=back tooltip="include"]
    "51" -> "26" [dir=back tooltip="include"]
    "51" -> "21" [dir=back tooltip="include"]
    "51" -> "4" [dir=back tooltip="include"]
    "51" -> "39" [dir=back tooltip="include"]
    "51" -> "40" [dir=back tooltip="include"]
    "51" -> "22" [dir=back tooltip="include"]
    "51" -> "6" [dir=back tooltip="include"]
    "51" -> "32" [dir=back tooltip="include"]
    "24" -> "25" [dir=back tooltip="include"]
    "24" -> "26" [dir=back tooltip="include"]
    "24" -> "21" [dir=back tooltip="include"]
    "24" -> "4" [dir=back tooltip="include"]
    "41" -> "2" [dir=back tooltip="include"]
    "41" -> "42" [dir=back tooltip="include"]
    "41" -> "13" [dir=back tooltip="include"]
    "41" -> "21" [dir=back tooltip="include"]
    "45" -> "16" [dir=back tooltip="include"]
    "45" -> "29" [dir=back tooltip="include"]
    "45" -> "34" [dir=back tooltip="include"]
    "45" -> "30" [dir=back tooltip="include"]
    "45" -> "46" [dir=back tooltip="include"]
    "15" -> "16" [dir=back tooltip="include"]
    "15" -> "14" [dir=back tooltip="include"]
    "15" -> "18" [dir=back tooltip="include"]
    "15" -> "20" [dir=back tooltip="include"]
    "15" -> "11" [dir=back tooltip="include"]
    "15" -> "2" [dir=back tooltip="include"]
    "15" -> "23" [dir=back tooltip="include"]
    "15" -> "3" [dir=back tooltip="include"]
    "15" -> "17" [dir=back tooltip="include"]
    "15" -> "29" [dir=back tooltip="include"]
    "15" -> "13" [dir=back tooltip="include"]
    "15" -> "34" [dir=back tooltip="include"]
    "15" -> "27" [dir=back tooltip="include"]
    "15" -> "26" [dir=back tooltip="include"]
    "15" -> "21" [dir=back tooltip="include"]
    "15" -> "4" [dir=back tooltip="include"]
    "15" -> "39" [dir=back tooltip="include"]
    "15" -> "40" [dir=back tooltip="include"]
    "15" -> "5" [dir=back tooltip="include"]
    "15" -> "6" [dir=back tooltip="include"]
    "15" -> "41" [dir=back tooltip="include"]
    "15" -> "31" [dir=back tooltip="include"]
    "15" -> "28" [dir=back tooltip="include"]
    "40" -> "25" [dir=back tooltip="include"]
    "40" -> "13" [dir=back tooltip="include"]
    "40" -> "26" [dir=back tooltip="include"]
    "40" -> "21" [dir=back tooltip="include"]
    "40" -> "4" [dir=back tooltip="include"]
    "40" -> "39" [dir=back tooltip="include"]
    "52" -> "8" [dir=back tooltip="include"]
    "31" -> "32" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "3" [dir=back tooltip="include"]
    "1" -> "4" [dir=back tooltip="include"]
    "1" -> "5" [dir=back tooltip="include"]
    "1" -> "6" [dir=back tooltip="include"]
    "1" -> "7" [dir=back tooltip="include"]
    "29" -> "16" [dir=back tooltip="include"]
    "29" -> "17" [dir=back tooltip="include"]
    "29" -> "13" [dir=back tooltip="include"]
    "29" -> "30" [dir=back tooltip="include"]
    "29" -> "31" [dir=back tooltip="include"]
    "29" -> "33" [dir=back tooltip="include"]
    "29" -> "28" [dir=back tooltip="include"]
    "49" -> "50" [dir=back tooltip="include"]
    "49" -> "2" [dir=back tooltip="include"]
    "49" -> "13" [dir=back tooltip="include"]
    "7" -> "8" [dir=back tooltip="include"]
    "7" -> "9" [dir=back tooltip="include"]
    "7" -> "14" [dir=back tooltip="include"]
    "7" -> "15" [dir=back tooltip="include"]
    "7" -> "43" [dir=back tooltip="include"]
    "7" -> "44" [dir=back tooltip="include"]
    "7" -> "45" [dir=back tooltip="include"]
    "7" -> "47" [dir=back tooltip="include"]
    "7" -> "48" [dir=back tooltip="include"]
    "7" -> "25" [dir=back tooltip="include"]
    "7" -> "12" [dir=back tooltip="include"]
    "7" -> "23" [dir=back tooltip="include"]
    "7" -> "3" [dir=back tooltip="include"]
    "7" -> "17" [dir=back tooltip="include"]
    "7" -> "29" [dir=back tooltip="include"]
    "7" -> "13" [dir=back tooltip="include"]
    "7" -> "27" [dir=back tooltip="include"]
    "7" -> "26" [dir=back tooltip="include"]
    "7" -> "21" [dir=back tooltip="include"]
    "7" -> "4" [dir=back tooltip="include"]
    "7" -> "52" [dir=back tooltip="include"]
    "7" -> "40" [dir=back tooltip="include"]
    "7" -> "46" [dir=back tooltip="include"]
    "7" -> "31" [dir=back tooltip="include"]
    "7" -> "28" [dir=back tooltip="include"]
    "23" -> "24" [dir=back tooltip="include"]
    "23" -> "12" [dir=back tooltip="include"]
    "23" -> "13" [dir=back tooltip="include"]
    "23" -> "27" [dir=back tooltip="include"]
    "23" -> "26" [dir=back tooltip="include"]
    "23" -> "21" [dir=back tooltip="include"]
    "23" -> "4" [dir=back tooltip="include"]
    "23" -> "22" [dir=back tooltip="include"]
    "23" -> "28" [dir=back tooltip="include"]
    "38" -> "4" [dir=back tooltip="include"]
    "35" -> "27" [dir=back tooltip="include"]
    "36" -> "26" [dir=back tooltip="include"]
    "20" -> "14" [dir=back tooltip="include"]
    "20" -> "2" [dir=back tooltip="include"]
    "20" -> "3" [dir=back tooltip="include"]
    "20" -> "21" [dir=back tooltip="include"]
    "20" -> "4" [dir=back tooltip="include"]
    "20" -> "22" [dir=back tooltip="include"]
    "20" -> "5" [dir=back tooltip="include"]
    "20" -> "6" [dir=back tooltip="include"]
    "33" -> "14" [dir=back tooltip="include"]
    "33" -> "2" [dir=back tooltip="include"]
    "33" -> "17" [dir=back tooltip="include"]
    "33" -> "13" [dir=back tooltip="include"]
    "33" -> "21" [dir=back tooltip="include"]
    "33" -> "6" [dir=back tooltip="include"]
    "34" -> "17" [dir=back tooltip="include"]
    "34" -> "13" [dir=back tooltip="include"]
    "34" -> "27" [dir=back tooltip="include"]
    "34" -> "35" [dir=back tooltip="include"]
    "34" -> "26" [dir=back tooltip="include"]
    "34" -> "36" [dir=back tooltip="include"]
    "34" -> "21" [dir=back tooltip="include"]
    "34" -> "37" [dir=back tooltip="include"]
    "34" -> "4" [dir=back tooltip="include"]
    "34" -> "38" [dir=back tooltip="include"]
    "34" -> "22" [dir=back tooltip="include"]
    "18" -> "19" [dir=back tooltip="include"]
    "18" -> "3" [dir=back tooltip="include"]
    "48" -> "49" [dir=back tooltip="include"]
    "48" -> "14" [dir=back tooltip="include"]
    "48" -> "15" [dir=back tooltip="include"]
    "48" -> "51" [dir=back tooltip="include"]
    "48" -> "2" [dir=back tooltip="include"]
    "48" -> "3" [dir=back tooltip="include"]
    "48" -> "17" [dir=back tooltip="include"]
    "48" -> "29" [dir=back tooltip="include"]
    "48" -> "13" [dir=back tooltip="include"]
    "48" -> "27" [dir=back tooltip="include"]
    "48" -> "26" [dir=back tooltip="include"]
    "48" -> "36" [dir=back tooltip="include"]
    "48" -> "21" [dir=back tooltip="include"]
    "48" -> "37" [dir=back tooltip="include"]
    "48" -> "4" [dir=back tooltip="include"]
    "48" -> "38" [dir=back tooltip="include"]
    "48" -> "39" [dir=back tooltip="include"]
    "48" -> "40" [dir=back tooltip="include"]
    "48" -> "22" [dir=back tooltip="include"]
    "48" -> "46" [dir=back tooltip="include"]
    "48" -> "41" [dir=back tooltip="include"]
    "48" -> "32" [dir=back tooltip="include"]
    "48" -> "33" [dir=back tooltip="include"]
    "37" -> "21" [dir=back tooltip="include"]
    "37" -> "4" [dir=back tooltip="include"]
    "47" -> "11" [dir=back tooltip="include"]
    "47" -> "17" [dir=back tooltip="include"]
    "47" -> "13" [dir=back tooltip="include"]
}

Defines

ATOMIC
TYPEDEF_CONTEXT
TYPEDEF_GLOBALCONTEXT

Typedefs

typedef struct Context Context
typedef struct GlobalContext GlobalContext

Functions

struct RefcBinary *refc_binary_create_resource(size_t size, struct ResourceType *resource_type)

Create a reference-counted resource object outside of the process heap.

This function will create a reference-counted resource object outside of the context heap. A blob will be allocated in the VM memory (e.g., via malloc). The allocated data will include an internal data structure that includes the data size and reference count.

Parameters:
  • size – the size of the data to create

  • resource_type – the resource type, NULL for regular refc binaries.

Returns:

a pointer to the out-of-context data.

static inline struct RefcBinary *refc_binary_create_refc(size_t size)

Create a reference-counted binary outside of the process heap.

This function will create a reference-counted binary outside of the context heap. A blob will be allocated in the VM memory (e.g., via malloc). The allocated data will include an internal data structure that includes the data size and reference count.

Parameters:
  • size – the size of the data to create

Returns:

a pointer to the out-of-context data.

const char *refc_binary_get_data(const struct RefcBinary *ptr)

get the data of the off-context binary

Return the data of the off-context binary

Parameters:
  • ptr – Refc binary returned from memory_create_refc_binary

struct RefcBinary *refc_binary_from_data(void *ptr)

get the refc binary from its pointer

This must only be passed the result of refc_binary_get_data.

Parameters:
  • ptr – pointer obtained from refc_binary_get_data

void refc_binary_increment_refcount(struct RefcBinary *ptr)

Increment the reference count on the refc binary.

Parameters:
  • ptr – the refc binary

bool refc_binary_decrement_refcount(struct RefcBinary *ptr, GlobalContext *global)

Decrement the reference count on the refc binary.

This function will call refc_binary_destroy if the reference count reaches 0.

Parameters:
  • ptr – the refc binary

  • global – the global context

Returns:

true if the refc binary was free’d; false, otherwise

void refc_binary_destroy(struct RefcBinary *refc, struct GlobalContext *global)

Destroy a refc binary after its reference count reached 0.

This function will call the destructor if the refc binary is a resource and will free the refc binary.

Parameters:
  • refc – the binary to destroy

  • global – the global context

term refc_binary_create_binary_info(Context *ctx)

TODO consider implementing erlang:memory/0,1 instead

size_t refc_binary_total_size(Context *ctx)

Return the total size (in bytes) of all reference counted binaries.

Returns:

the total size (in bytes) of all reference counted binaries

struct RefcBinary
#include <refc_binary.h>

Collaboration diagram for RefcBinary:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "18" [label="SpinLock" tooltip="SpinLock"]
    "2" [label="ResourceType" tooltip="ResourceType"]
    "12" [label="Module" tooltip="Module"]
    "11" [label="ListHead" tooltip="ListHead"]
    "9" [label="RefcBinaryQueueItem" tooltip="RefcBinaryQueueItem"]
    "3" [label="GlobalContext" tooltip="GlobalContext"]
    "14" [label="ModuleFilename" tooltip="ModuleFilename"]
    "8" [label="HNodeGroup" tooltip="HNodeGroup"]
    "17" [label="TimerList" tooltip="TimerList"]
    "15" [label="LiteralEntry" tooltip="LiteralEntry"]
    "5" [label="MailboxMessage" tooltip="MailboxMessage"]
    "4" [label="MessageQueueItem" tooltip="MessageQueueItem"]
    "16" [label="AtomsHashTable" tooltip="AtomsHashTable"]
    "1" [label="RefcBinary" tooltip="RefcBinary" fillcolor="#BFBFBF"]
    "6" [label="AtomTable" tooltip="AtomTable"]
    "13" [label="ExportedFunction" tooltip="ExportedFunction"]
    "10" [label="SyncList" tooltip="SyncList"]
    "7" [label="HNode" tooltip="HNode"]
    "2" -> "3" [dir=forward tooltip="usage"]
    "2" -> "11" [dir=forward tooltip="usage"]
    "12" -> "13" [dir=forward tooltip="usage"]
    "12" -> "14" [dir=forward tooltip="usage"]
    "12" -> "15" [dir=forward tooltip="usage"]
    "12" -> "11" [dir=forward tooltip="usage"]
    "11" -> "11" [dir=forward tooltip="usage"]
    "9" -> "1" [dir=forward tooltip="usage"]
    "9" -> "9" [dir=forward tooltip="usage"]
    "3" -> "4" [dir=forward tooltip="usage"]
    "3" -> "6" [dir=forward tooltip="usage"]
    "3" -> "9" [dir=forward tooltip="usage"]
    "3" -> "10" [dir=forward tooltip="usage"]
    "3" -> "12" [dir=forward tooltip="usage"]
    "3" -> "16" [dir=forward tooltip="usage"]
    "3" -> "17" [dir=forward tooltip="usage"]
    "3" -> "18" [dir=forward tooltip="usage"]
    "3" -> "11" [dir=forward tooltip="usage"]
    "8" -> "7" [dir=forward tooltip="usage"]
    "8" -> "8" [dir=forward tooltip="usage"]
    "17" -> "11" [dir=forward tooltip="usage"]
    "5" -> "5" [dir=forward tooltip="usage"]
    "4" -> "5" [dir=forward tooltip="usage"]
    "4" -> "4" [dir=forward tooltip="usage"]
    "16" -> "7" [dir=forward tooltip="usage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "1" -> "11" [dir=forward tooltip="usage"]
    "6" -> "7" [dir=forward tooltip="usage"]
    "6" -> "8" [dir=forward tooltip="usage"]
    "10" -> "11" [dir=forward tooltip="usage"]
    "7" -> "7" [dir=forward tooltip="usage"]
}

Public Members

struct ListHead head
size_t ref_count
size_t size
struct ResourceType *resource_type
uint8_t data[]