pike.git/
src/
stralloc.c
Branch:
Tag:
Non-build tags
All tags
No tags
2014-08-24
2014-08-24 12:36:43 by Arne Goedeke <el@laramies.com>
a206aca82c28347d226cdb3ecf5ada2af056fa66 (
25
lines) (+
25
/-
0
)
[
Show
|
Annotate
]
Branch:
arne/string_alloc
Strings: print string types in memory_usage()
2277:
#endif /* DO_PIKE_CLEANUP */ }
+
void count_string_types() {
+
unsigned INT32 e;
+
size_t num_static = 0, num_short = 0;
+
+
for (e = 0; e < htable_size; e++) {
+
struct pike_string * s;
+
+
for (s = base_table[e]; s; s = s->next)
+
switch (s->flags & STRING_ALLOC_MASK) {
+
case STRING_ALLOC_BA:
+
num_short ++;
+
break;
+
case STRING_ALLOC_STATIC:
+
num_static ++;
+
break;
+
}
+
}
+
+
push_static_text("num_short_pike_strings");
+
push_ulongest(num_short);
+
push_static_text("num_static_pike_strings");
+
push_ulongest(num_static);
+
}
+
size_t count_memory_in_string(const struct pike_string * s) { size_t size = sizeof(struct pike_string);