diff options
author | Peter Zhu <[email protected]> | 2024-03-21 12:17:15 -0400 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-03-27 08:24:28 +0900 |
commit | 6e34386794db69949b13f055fa338431527910eb (patch) | |
tree | 1b75d58c435932234505c4510c59579817f15032 /test/openssl | |
parent | b2b665eba59e3fc9ad9656d9c74509a975db6fe8 (diff) |
[flori/json] Fix memory leak when exception is raised during JSON generation
If an exception is raised the FBuffer is leaked.
For example, the following script leaks memory:
o = Object.new
def o.to_json(a) = raise
10.times do
100_000.times do
begin
JSON(o)
rescue
end
end
puts `ps -o rss= -p #{$$}`
end
Before:
31824
35696
40240
44304
47424
50944
54000
58384
62416
65296
After:
24416
24640
24640
24736
24736
24736
24736
24736
24736
24736
https://github.com/flori/json/commit/44df509dc2
Diffstat (limited to 'test/openssl')
0 files changed, 0 insertions, 0 deletions