We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58605dd commit 86444e5Copy full SHA for 86444e5
1 file changed
darray.h
@@ -4,6 +4,7 @@
4
#include <stdint.h>
5
#include <stddef.h>
6
#include <stdlib.h>
7
+#include "ruby/ruby.h"
8
9
// Type for a dynamic array. Use to declare a dynamic array.
10
// It is a pointer so it fits in st_table nicely. Designed
@@ -147,6 +148,9 @@ rb_darray_size(const void *ary)
147
148
return meta ? meta->size : 0;
149
}
150
151
+/* Estimate of the amount of memory used by this darray.
152
+ * Useful for TypedData objects. */
153
+#define rb_darray_memsize(ary) (sizeof(*(ary)) + (rb_darray_size(ary) * sizeof((ary)->data[0])))
154
155
static inline void
156
rb_darray_pop(void *ary, size_t count)
0 commit comments