repo.or.cz
/
ruby.git
/
commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
raw
|
patch
|
inline
|
side by side
(parent:
d75bbba
)
Fix memory leak in ruby_parser
author
Peter Zhu
<
[email protected]
>
Mon, 29 Apr 2024 17:06:39 +0000
(29 13:06 -0400)
committer
Peter Zhu
<
[email protected]
>
Mon, 29 Apr 2024 18:04:42 +0000
(29 14:04 -0400)
For example:
10.times do
100_000.times do
eval("")
end
puts `ps -o rss= -p #{$$}`
end
Before:
19872
26480
32848
39504
45904
52672
59200
65760
72128
78496
After:
17328
20752
23664
28400
30656
34224
37424
40784
43328
46656
ruby_parser.c
patch
|
blob
|
blame
|
history
diff --git
a/ruby_parser.c
b/ruby_parser.c
index
d8b7580
..
1e9f4d1
100644
(file)
--- a/
ruby_parser.c
+++ b/
ruby_parser.c
@@
-518,6
+518,7
@@
parser_free(void *ptr)
{
struct ruby_parser *parser = (struct ruby_parser*)ptr;
rb_ruby_parser_free(parser->parser_params);
+ xfree(parser);
}
static size_t