summaryrefslogtreecommitdiff
path: root/parser_st.h
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-06-29 09:21:11 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-06-29 11:16:50 -0400
commitf0d08d11dcd404f3146c0d71d6ff743bbc6e7193 (patch)
tree82e6bb0fff741e124915c7a2f6aabe54a484ee71 /parser_st.h
parentdf2b3a29987e9353596af76ed77f35d7366d654e (diff)
Fix memory leak when copying ST tables
st_copy allocates a st_table, which is not needed for hashes since it is allocated by VWA and embedded, so this causes a memory leak. The following script demonstrates the issue: ```ruby 20.times do 100_000.times do {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9} end puts `ps -o rss= -p #{$$}` end ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8000
Diffstat (limited to 'parser_st.h')
-rw-r--r--parser_st.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/parser_st.h b/parser_st.h
index 85db3b5847..877b1e9051 100644
--- a/parser_st.h
+++ b/parser_st.h
@@ -137,6 +137,7 @@ void rb_parser_st_add_direct(parser_st_table *, parser_st_data_t, parser_st_data
void rb_parser_st_free_table(parser_st_table *);
void rb_parser_st_cleanup_safe(parser_st_table *, parser_st_data_t);
void rb_parser_st_clear(parser_st_table *);
+parser_st_table *rb_parser_st_replace(parser_st_table *, parser_st_table *);
parser_st_table *rb_parser_st_copy(parser_st_table *);
CONSTFUNC(int rb_parser_st_numcmp(parser_st_data_t, parser_st_data_t));
CONSTFUNC(parser_st_index_t rb_parser_st_numhash(parser_st_data_t));