Project

General

Profile

Actions

Bug #8984

closed

ObjectSpace.memsize_of(obj) should return with sizeof(RVALUE)

Added by ko1 (Koichi Sasada) about 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:57666]

Description

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.

Actions

Also available in: Atom PDF