File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,11 @@ void sample_typed_wrapped_struct_mark(void* st) {
43
43
}
44
44
45
45
size_t sample_typed_wrapped_struct_memsize (const void * st ) {
46
- return sizeof (struct sample_typed_wrapped_struct );
46
+ if (st == NULL ) {
47
+ return 0 ;
48
+ } else {
49
+ return ((struct sample_typed_wrapped_struct * )st )-> foo ;
50
+ }
47
51
}
48
52
49
53
static const rb_data_type_t sample_typed_wrapped_struct_data_type = {
Original file line number Diff line number Diff line change 1
1
require_relative 'spec_helper'
2
+ require 'objspace'
2
3
3
4
load_extension ( "typed_data" )
4
5
7
8
@s = CApiAllocTypedSpecs . new
8
9
@s . typed_wrapped_data . should == 42 # not defined in initialize
9
10
end
11
+
12
+ it "uses the specified memsize function for ObjectSpace.memsize" do
13
+ @s = CApiAllocTypedSpecs . new
14
+ ObjectSpace . memsize_of ( @s ) . should > 42
15
+ end
10
16
end
11
17
12
18
describe "CApiWrappedTypedStruct" do
You can’t perform that action at this time.
0 commit comments