Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
18e3d39e
Unverified
Commit
18e3d39e
authored
Aug 18, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed wrong size calculation for `memsize_of()`.
parent
55163a8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
mrbgems/mruby-os-memsize/src/memsize.c
mrbgems/mruby-os-memsize/src/memsize.c
+8
-14
No files found.
mrbgems/mruby-os-memsize/src/memsize.c
View file @
18e3d39e
...
@@ -108,17 +108,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
...
@@ -108,17 +108,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
if
(
!
MRB_PROC_CFUNC_P
(
proc
))
size
+=
os_memsize_of_irep
(
mrb
,
proc
->
body
.
irep
);
if
(
!
MRB_PROC_CFUNC_P
(
proc
))
size
+=
os_memsize_of_irep
(
mrb
,
proc
->
body
.
irep
);
break
;
break
;
}
}
case
MRB_TT_DATA
:
size
+=
mrb_objspace_page_slot_size
();
break
;
#ifndef MRB_NO_FLOAT
case
MRB_TT_FLOAT
:
#ifdef MRB_WORD_BOXING
size
+=
mrb_objspace_page_slot_size
()
+
sizeof
(
struct
RFloat
);
#endif
break
;
#endif
case
MRB_TT_RANGE
:
case
MRB_TT_RANGE
:
#ifndef MRB_RANGE_EMBED
#ifndef MRB_RANGE_EMBED
size
+=
mrb_objspace_page_slot_size
()
+
size
+=
mrb_objspace_page_slot_size
()
+
...
@@ -131,12 +120,18 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
...
@@ -131,12 +120,18 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
ptrdiff_t
ci_size
=
f
->
cxt
->
ciend
-
f
->
cxt
->
cibase
;
ptrdiff_t
ci_size
=
f
->
cxt
->
ciend
-
f
->
cxt
->
cibase
;
size
+=
mrb_objspace_page_slot_size
()
+
size
+=
mrb_objspace_page_slot_size
()
+
sizeof
(
struct
RFiber
)
+
sizeof
(
struct
mrb_context
)
+
sizeof
(
struct
mrb_context
)
+
sizeof
(
mrb_value
)
*
stack_size
+
sizeof
(
mrb_value
)
*
stack_size
+
sizeof
(
mrb_callinfo
)
*
ci_size
;
sizeof
(
mrb_callinfo
)
*
ci_size
;
break
;
break
;
}
}
#ifndef MRB_NO_FLOAT
case
MRB_TT_FLOAT
:
#endif
case
MRB_TT_INTEGER
:
if
(
mrb_immediate_p
(
obj
))
break
;
case
MRB_TT_DATA
:
case
MRB_TT_ISTRUCT
:
case
MRB_TT_ISTRUCT
:
size
+=
mrb_objspace_page_slot_size
();
size
+=
mrb_objspace_page_slot_size
();
break
;
break
;
...
@@ -144,7 +139,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
...
@@ -144,7 +139,6 @@ os_memsize_of_object(mrb_state* mrb, mrb_value obj)
* immediate VM stack values, contained within mrb_state, or on C stack */
* immediate VM stack values, contained within mrb_state, or on C stack */
case
MRB_TT_TRUE
:
case
MRB_TT_TRUE
:
case
MRB_TT_FALSE
:
case
MRB_TT_FALSE
:
case
MRB_TT_INTEGER
:
case
MRB_TT_BREAK
:
case
MRB_TT_BREAK
:
case
MRB_TT_CPTR
:
case
MRB_TT_CPTR
:
case
MRB_TT_SYMBOL
:
case
MRB_TT_SYMBOL
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment