mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Free everything at shutdown
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
This commit is contained in:
parent
b361a800c2
commit
6816e8efcf
27 changed files with 285 additions and 6 deletions
22
transcode.c
22
transcode.c
|
@ -181,6 +181,28 @@ typedef struct {
|
|||
|
||||
static st_table *transcoder_table;
|
||||
|
||||
static int
|
||||
free_inner_transcode_i(st_data_t key, st_data_t val, st_data_t arg)
|
||||
{
|
||||
xfree((void *)val);
|
||||
return ST_DELETE;
|
||||
}
|
||||
|
||||
static int
|
||||
free_transcode_i(st_data_t key, st_data_t val, st_data_t arg)
|
||||
{
|
||||
st_foreach((void *)val, free_inner_transcode_i, 0);
|
||||
st_free_table((void *)val);
|
||||
return ST_DELETE;
|
||||
}
|
||||
|
||||
void
|
||||
rb_free_transcoder_table(void)
|
||||
{
|
||||
st_foreach(transcoder_table, free_transcode_i, 0);
|
||||
st_free_table(transcoder_table);
|
||||
}
|
||||
|
||||
static transcoder_entry_t *
|
||||
make_transcoder_entry(const char *sname, const char *dname)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue