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"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" fillcolor="#BFBFBF"]
    "8" [label="assert.h" tooltip="assert.h"]
    "13" [label="utils.h" tooltip="utils.h"]
    "4" [label="list.h" tooltip="list.h"]
    "11" [label="stdint.h" tooltip="stdint.h"]
    "3" [label="stdlib.h" tooltip="stdlib.h"]
    "12" [label="memory.h" tooltip="memory.h"]
    "5" [label="resources.h" tooltip="resources.h"]
    "14" [label="stddef.h" tooltip="stddef.h"]
    "6" [label="erl_nif.h" tooltip="erl_nif.h"]
    "9" [label="limits.h" tooltip="limits.h"]
    "7" [label="term_typedef.h" tooltip="term_typedef.h"]
    "15" [label="stdio.h" tooltip="stdio.h"]
    "10" [label="inttypes.h" tooltip="inttypes.h"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "5" [dir=forward tooltip="include"]
    "13" -> "14" [dir=forward tooltip="include"]
    "13" -> "15" [dir=forward tooltip="include"]
    "13" -> "3" [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"]
    "5" -> "3" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "5" -> "4" [dir=forward tooltip="include"]
    "5" -> "12" [dir=forward tooltip="include"]
    "6" -> "7" [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"]
}

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"]
    "12" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "5" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "23" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "20" [label="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "13" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" fillcolor="#BFBFBF"]
    "34" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "51" [label="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
    "43" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
    "44" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h"]
    "14" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "8" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "15" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.h"]
    "16" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "27" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "35" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
    "3" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "33" [label="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "17" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "29" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "26" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "36" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
    "6" [label="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "25" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "28" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "24" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h"]
    "7" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.h"]
    "45" [label="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h"]
    "19" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "18" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "11" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
    "47" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h"]
    "50" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
    "49" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
    "2" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "48" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
    "30" [label="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "10" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c"]
    "9" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h"]
    "52" [label="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h"]
    "41" [label="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "21" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "37" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "32" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "31" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "4" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
    "38" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
    "22" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "46" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "42" [label="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "39" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "40" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "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"]
    "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"]
    "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"]
    "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"]
    "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"]
    "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"]
    "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"]
    "16" -> "8" [dir=back tooltip="include"]
    "16" -> "17" [dir=back tooltip="include"]
    "16" -> "13" [dir=back tooltip="include"]
    "35" -> "27" [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"]
    "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"]
    "36" -> "26" [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"]
    "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"]
    "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"]
    "18" -> "19" [dir=back tooltip="include"]
    "18" -> "3" [dir=back tooltip="include"]
    "47" -> "11" [dir=back tooltip="include"]
    "47" -> "17" [dir=back tooltip="include"]
    "47" -> "13" [dir=back tooltip="include"]
    "49" -> "50" [dir=back tooltip="include"]
    "49" -> "2" [dir=back tooltip="include"]
    "49" -> "13" [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"]
    "30" -> "13" [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"]
    "52" -> "8" [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"]
    "37" -> "21" [dir=back tooltip="include"]
    "37" -> "4" [dir=back tooltip="include"]
    "31" -> "32" [dir=back tooltip="include"]
    "38" -> "4" [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"]
    "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"]
}

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[]