Avoid using FPU with `mruby-os-memsize`; ref
And, in the calculation of the instance variable size, the fraction was
always rounded down because of division of integers, so fix it.
At the same time, test items that are no longer passed due to this
change are deleted.
MODIFY
mrbgems/mruby-os-memsize/test/memsize.rb
mrbgems/mruby-os-memsize/test/memsize.rb
@@ -22,20 +22,6 @@ assert 'ObjectSpace.memsize_of' do
empty_class_def_size = ObjectSpace.memsize_of Class.new
assert_not_equal empty_class_def_size, 0, 'Class def not zero'
- class_without_methods = Class.new do
- @a = 1
- @b = 2
- end
- class_total_size = empty_class_def_size + (int_size * 2)
- assert_equal ObjectSpace.memsize_of(class_without_methods), class_total_size, 'class without methods size'
-
- module_without_methods = Module.new do
- @a = 1
- @b = 2
- end
- module_total_size = empty_class_def_size + (int_size * 2)
- assert_equal ObjectSpace.memsize_of(module_without_methods), module_total_size, 'module without methods size'
-
proc_size = ObjectSpace.memsize_of Proc.new { x = 1; x }
assert_not_equal proc_size, 0

MODIFY
src/variable.c
src/variable.c
** See Copyright Notice in mruby.h
*/
-#include <math.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
@@ -1132,9 +1131,9 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c)
mrb_int
mrb_obj_iv_tbl_memsize(mrb_state* mrb, mrb_value obj)
{
- return sizeof(iv_tbl) +
- (sizeof(segment) * ceil(iv_size(mrb, mrb_obj_ptr(obj)->iv)/
- MRB_IV_SEGMENT_SIZE));
+ size_t ivsize = iv_size(mrb, mrb_obj_ptr(obj)->iv);
+ size_t ivsegs = (ivsize + MRB_IV_SEGMENT_SIZE - 1) / MRB_IV_SEGMENT_SIZE;
+ return sizeof(iv_tbl) + (sizeof(segment) * ivsegs);
}
#define identchar(c) (ISALNUM(c) || (c) == '_' || !ISASCII(c))

Avoid using FPU with `mruby-os-memsize`; ref #5032

And, in the calculation of the instance variable size, the fraction was
always rounded down because of division of integers, so fix it.

At the same time, test items that are no longer passed due to this
change are deleted.