summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/string.c b/string.c
index c9621d399d..7f107c26ad 100644
--- a/string.c
+++ b/string.c
@@ -758,6 +758,17 @@ rb_str_free(VALUE str)
}
}
+size_t
+rb_str_memsize(VALUE str)
+{
+ if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
+ return RSTRING(str)->as.heap.aux.capa;
+ }
+ else {
+ return 0;
+ }
+}
+
VALUE
rb_str_to_str(VALUE str)
{