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
69bc477b
Commit
69bc477b
authored
May 19, 2020
by
Rory OConnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding warnings for mrb_load functions leaking RProc objects
parent
3655d4e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
include/mruby/compile.h
include/mruby/compile.h
+9
-1
include/mruby/irep.h
include/mruby/irep.h
+10
-0
No files found.
include/mruby/compile.h
View file @
69bc477b
...
...
@@ -180,7 +180,15 @@ MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,size_t
MRB_API
struct
RProc
*
mrb_generate_code
(
mrb_state
*
,
struct
mrb_parser_state
*
);
MRB_API
mrb_value
mrb_load_exec
(
mrb_state
*
mrb
,
struct
mrb_parser_state
*
p
,
mrbc_context
*
c
);
/* program load functions */
/** program load functions
* Please note! Currently due to interactions with the GC calling these functions will
* leak one RProc object per function call.
* To prevent this save the current memory arena before calling and restore the arena
* right after, like so
* int ai = mrb_gc_arena_save(mrb);
* mrb_value status = mrb_load_string(mrb, buffer);
* mrb_gc_arena_restore(mrb, ai);
*/
#ifndef MRB_DISABLE_STDIO
MRB_API
mrb_value
mrb_load_file
(
mrb_state
*
,
FILE
*
);
MRB_API
mrb_value
mrb_load_file_cxt
(
mrb_state
*
,
FILE
*
,
mrbc_context
*
cxt
);
...
...
include/mruby/irep.h
View file @
69bc477b
...
...
@@ -49,6 +49,16 @@ typedef struct mrb_irep {
MRB_API
mrb_irep
*
mrb_add_irep
(
mrb_state
*
mrb
);
/** load mruby bytecode functions
* Please note! Currently due to interactions with the GC calling these functions will
* leak one RProc object per function call.
* To prevent this save the current memory arena before calling and restore the arena
* right after, like so
* int ai = mrb_gc_arena_save(mrb);
* mrb_value status = mrb_load_irep(mrb, buffer);
* mrb_gc_arena_restore(mrb, ai);
*/
/* @param [const uint8_t*] irep code, expected as a literal */
MRB_API
mrb_value
mrb_load_irep
(
mrb_state
*
,
const
uint8_t
*
);
...
...
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