summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2025-10-31 23:52:23 +0900
committergit <svn-admin@ruby-lang.org>2025-10-31 16:02:26 +0000
commit6bdb2027f64df8e6f59273488ea01ed1614bcf76 (patch)
treefd0bc93a3aa810ac8c9a43fca9f490292e3ba7f2 /include
parent65168b7eafd30fd3958d71761fa155bba00cdec5 (diff)
[ruby/json] Fix memory leak when exception is raised during JSON generation part 2
Commit https://github.com/ruby/json/commit/44df509dc2de fixed it for StandardError, but other exceptions and jumps are also possible. Use rb_ensure() to release FBuffer instead of rb_rescue(). A reproducer: o = Object.new def o.to_json(a) = throw :a a = ["make heap allocation"*100, o] 10.times do 100_000.times do catch(:a) { JSON(a) } end puts `ps -o rss= -p #{$$}` end https://github.com/ruby/json/commit/9b7b648ecd
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions