From: shibata.hiroshi@... Date: 2014-01-30T06:17:21+00:00 Subject: [ruby-core:60314] [ruby-trunk - Bug #8984] ObjectSpace.memsize_of(obj) should return with sizeof(RVALUE) Issue #8984 has been updated by Hiroshi SHIBATA. Target version changed from 2.1.0 to current: 2.2.0 ---------------------------------------- Bug #8984: ObjectSpace.memsize_of(obj) should return with sizeof(RVALUE) https://bugs.ruby-lang.org/issues/8984#change-44805 * Author: Koichi Sasada * Status: Assigned * Priority: Normal * Assignee: Koichi Sasada * Category: ext * Target version: current: 2.2.0 * ruby -v: - * Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN ---------------------------------------- Now, ObjectSpace.memsize_of(obj) return without sizeof(RVALUE). For example, ObjectSpace.memsize_of('foo') returns 0 because shorter string are embedded in RVALUE. Proposal is returning the size including sizeof(RVALUE). If we introduce variable RVALUE size (*1), then it will help. *1: for example, T_FLOAT only use sizeof(double). Only 2 words (or 1 word on 64bit enviornment) are needed. Question is: it breaks compatibility, but anyone care about it? Another option is to add optional parameter. memsize_of(obj, include_rvalue: true), etc. -- http://bugs.ruby-lang.org/