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
597978c1
Commit
597978c1
authored
Jun 03, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mrb_malloc/calloc/realloc should call mrb_garbage_collect before returning NULL
parent
479df23b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
src/gc.c
src/gc.c
+11
-5
No files found.
src/gc.c
View file @
597978c1
...
...
@@ -121,25 +121,31 @@ gettimeofday_time(void)
#define GC_STEP_SIZE 1024
void
*
mrb_realloc
(
mrb_state
*
mrb
,
void
*
p
,
size_t
len
)
{
return
(
mrb
->
allocf
)(
mrb
,
p
,
len
);
p
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
);
if
(
!
p
&&
len
>
0
&&
mrb
->
heaps
)
{
mrb_garbage_collect
(
mrb
);
p
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
);
}
return
p
;
}
void
*
mrb_malloc
(
mrb_state
*
mrb
,
size_t
len
)
{
return
(
mrb
->
allocf
)
(
mrb
,
0
,
len
);
return
mrb_realloc
(
mrb
,
0
,
len
);
}
void
*
mrb_calloc
(
mrb_state
*
mrb
,
size_t
nelem
,
size_t
len
)
{
void
*
p
=
(
mrb
->
allocf
)
(
mrb
,
0
,
nelem
*
len
);
void
*
p
=
mrb_realloc
(
mrb
,
0
,
nelem
*
len
);
memset
(
p
,
0
,
nelem
*
len
);
if
(
len
>
0
)
memset
(
p
,
0
,
nelem
*
len
);
return
p
;
}
...
...
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