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
7c2f6886
Commit
7c2f6886
authored
Apr 01, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1121 from monaka/pr-check-malloc-failed2
Check malloc failed
parents
57cf2644
c7ff1bd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
include/mruby.h
include/mruby.h
+1
-0
src/gc.c
src/gc.c
+14
-0
No files found.
include/mruby.h
View file @
7c2f6886
...
...
@@ -125,6 +125,7 @@ typedef struct mrb_state {
mrb_bool
gc_disabled
:
1
;
mrb_bool
gc_full
:
1
;
mrb_bool
is_generational_gc_mode
:
1
;
mrb_bool
out_of_memory
:
1
;
size_t
majorgc_old_threshold
;
struct
alloca_header
*
mems
;
...
...
src/gc.c
View file @
7c2f6886
...
...
@@ -157,6 +157,20 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
mrb_garbage_collect
(
mrb
);
p2
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
,
mrb
->
ud
);
}
if
(
!
p2
&&
len
)
{
if
(
mrb
->
out_of_memory
)
{
/* mrb_panic(mrb); */
}
else
{
mrb
->
out_of_memory
=
1
;
mrb_raise
(
mrb
,
E_RUNTIME_ERROR
,
"Out of memory"
);
}
}
else
{
mrb
->
out_of_memory
=
0
;
}
return
p2
;
}
...
...
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