mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
We need to keep a pointer to the originally allocated environ because
adding more environment variables can cause it to be changed to something
else.
For example:
100.times do |i|
ENV["FOO#{i}"] = "1"
end
Causes Valgrind to report:
312 bytes in 1 blocks are definitely lost in loss record 9 of 13
at 0x484D444: calloc (vg_replace_malloc.c:1340)
by 0x1884F8: calloc1 (gc.c:1844)
by 0x1884F8: objspace_xcalloc (gc.c:12202)
by 0x1884F8: ruby_xcalloc_body (gc.c:12209)
by 0x4204DD: ruby_init_setproctitle (setproctitle.c:119)
by 0x27DDF4: ruby_process_options (ruby.c:3101)
by 0x160BD1: ruby_options (eval.c:117)
by 0x15B96E: rb_main (main.c:40)
by 0x15B96E: main (main.c:59)