mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
![]() The call to setenv replaces the string in the environ array, which causes the original string to be reported as a memory leak. This commit allocates another copy of environ called alloc_environ that contains the strings allocated by ruby_init_setproctitle. Then in ruby_free_proctitle it frees all the strings in alloc_environ. For example: ENV.each { |k, v| ENV[k] = v.dup } Valgrind reports: 3,321 bytes in 39 blocks are definitely lost in loss record 3 of 3 at 0x484884F: malloc (vg_replace_malloc.c:393) by 0x25CB5B: objspace_xmalloc0 (gc.c:11972) by 0x40344E: ruby_strdup (util.c:540) by 0x59C854: ruby_init_setproctitle (setproctitle.c:143) by 0x38CC44: ruby_process_options (ruby.c:3101) by 0x234DB1: ruby_options (eval.c:117) by 0x15B92E: rb_main (main.c:40) by 0x15B92E: main (main.c:59) |
||
---|---|---|
.. | ||
acosh.c | ||
alloca.c | ||
cbrt.c | ||
close.c | ||
crt_externs.h | ||
crypt.c | ||
crypt.h | ||
des_tables.c | ||
dtoa.c | ||
erf.c | ||
explicit_bzero.c | ||
ffs.c | ||
file.h | ||
flock.c | ||
hypot.c | ||
langinfo.c | ||
lgamma_r.c | ||
memcmp.c | ||
memmove.c | ||
mt19937.c | ||
nan.c | ||
nextafter.c | ||
procstat_vm.c | ||
setproctitle.c | ||
strchr.c | ||
strerror.c | ||
strlcat.c | ||
strlcpy.c | ||
strstr.c | ||
tgamma.c | ||
x86_64-chkstk.S |