If the autoload_data has autoload_const and the autoload_data is freed before the autoload_const, then the autoload_data will leak.
This commit changes it so that when the autoload_data is freed, it will clear the whole linked list of autoload_const so that the autoload_data can be safely freed.
1000.times do |i| str = "foo#{i}".freeze autoload(:"B#{i}", str) autoload(:"C#{i}", str) end
Fix memory leak in autoload_data
If the autoload_data has autoload_const and the autoload_data is freed
before the autoload_const, then the autoload_data will leak.
This commit changes it so that when the autoload_data is freed, it will
clear the whole linked list of autoload_const so that the autoload_data
can be safely freed.
Reports leaked memory with the macOS leaks tool: