Add upb_Arena_SpaceAllocated function

Ref: https://github.com/protocolbuffers/protobuf/pull/10291

Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.

This feature is used by various memory profiling tools.
diff --git a/upb/arena.c b/upb/arena.c
index 15e7a6b..319698a 100644
--- a/upb/arena.c
+++ b/upb/arena.c
@@ -69,6 +69,24 @@
   return a;
 }
 
+size_t upb_Arena_SpaceAllocated(upb_Arena* arena) {
+  arena = arena_findroot(arena);
+  size_t memsize = 0;
+
+  mem_block* block = arena->freelist;
+
+  while (block) {
+    memsize += sizeof(mem_block) + block->size;
+    block = block->next;
+  }
+
+  return memsize;
+}
+
+uint32_t upb_Arena_DebugRefCount(upb_Arena* arena) {
+  return arena_findroot(arena)->refcount;
+}
+
 static void upb_Arena_addblock(upb_Arena* a, upb_Arena* root, void* ptr,
                                size_t size) {
   mem_block* block = ptr;