aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-05 04:51:01 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-05 04:51:01 +0000
commitd1674ef67b61df4ff27e93772c0946ae74869c5d (patch)
tree8ce4da84dab8b716b48695000f062fae92b201f1 /cont.c
parent5ba523967ec02f9abed15a219f776c3242e0e742 (diff)
downloadruby-d1674ef67b61df4ff27e93772c0946ae74869c5d.tar.gz
* gc.c: add support to estimate increase of oldspace memory usage.
This is another approach to solve an issue discussed at r43530. This feature is diabled as default. This feature measures an increment of memory consuption by oldgen objects. It measures memory consumption for each objects when the object is promoted. However, measurement of memory consumption is not accurate now. So that this measurement is `estimation'. To implement this feature, move memsize_of() function from ext/objspace/objspace.c and expose rb_obj_memsize_of(). Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to measure memory size, so that we ignores T_DATA objects now. For example, some functions skip NULL check for pointer. The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature, and turned off as default. We need to compare 3gen GC and this feature carefully. (it is possible to enable both feature) We need a help to compare them. * internal.h: expose rb_obj_memsize_of(). * ext/objspace/objspace.c: use rb_obj_memsize_of() function. * cont.c (fiber_memsize): fix to check NULL. * variable.c (autoload_memsize): ditto. * vm.c (vm_memsize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cont.c b/cont.c
index b976056955..6ac7a1ea57 100644
--- a/cont.c
+++ b/cont.c
@@ -351,7 +351,8 @@ fiber_memsize(const void *ptr)
size_t size = 0;
if (ptr) {
size = sizeof(*fib);
- if (fib->cont.type != ROOT_FIBER_CONTEXT) {
+ if (fib->cont.type != ROOT_FIBER_CONTEXT &&
+ fib->cont.saved_thread.local_storage != NULL) {
size += st_memsize(fib->cont.saved_thread.local_storage);
}
size += cont_memsize(&fib->cont);