diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2026-01-14 17:09:26 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2026-01-15 17:57:27 -0500 |
| commit | f7ae32ed3b5b93247f9f62a58e3dd129098d0b27 (patch) | |
| tree | 7c54a86e2eed05e2b04343e146541f6156337f01 /darray.h | |
| parent | 6e480e6714f0e63bc065f4d931f76e087131c743 (diff) | |
Pin ID symbols
Symbols with a corresponding ID should be pinned because they can be used
by things that don't support compaction.
Diffstat (limited to 'darray.h')
| -rw-r--r-- | darray.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include <stdint.h> #include <stddef.h> #include <stdlib.h> +#include "ruby/ruby.h" // Type for a dynamic array. Use to declare a dynamic array. // It is a pointer so it fits in st_table nicely. Designed @@ -147,6 +148,9 @@ rb_darray_size(const void *ary) return meta ? meta->size : 0; } +/* Estimate of the amount of memory used by this darray. + * Useful for TypedData objects. */ +#define rb_darray_memsize(ary) (sizeof(*(ary)) + (rb_darray_size(ary) * sizeof((ary)->data[0]))) static inline void rb_darray_pop(void *ary, size_t count) |
