On 07/11/2016 01:12 PM, Ancor Gonzalez Sosa wrote: > On 07/07/2016 07:38 PM, Ladislav Slezak wrote: >> >> Hi all, >> >> Ruby 2.1+ allows tracing object allocations, see more details in this >> article [1]. >> >> I enabled it and dumped the Ruby memory usage data in a SLES12-SP2 Beta3 >> installation. >> >> It is related to this Trello card [2] and this bug [3]. >> >> You can find more details and the dump in my Gist [4], here is a copy of the >> most >> interesting part: >> >> >> >> ## The Result >> >> A quick scan found out that the place which consumes most memory is >> >> /usr/share/YaST2/lib/installation/ssh_config_file.rb:45:STRING: count: 4, >> total size: 274056 >> >> which loads the SSH keys and configuration from the previous installation >> and needs >> about 270kB memory. >> >> The question is we can optimize it better, the SSH keys actually need to be >> stored >> somewhere as the target partition will be reformatted... > > A quite trivial modification would be to change SshConfigFile#content > and SshKey::KeyFile#content to store the content of the files in a > temporary file and not in memory. It should be completely harmless, > since that code is new, sane and covered by unit tests.
Imo just made me notice that a temporary file is memory as well. Never mind. I said nothing. ;-) Cheers. > https://github.com/yast/yast-installation/blob/fd94cd1477a4807a8fee6b50c95a97fac0860629/src/lib/installation/ssh_config_file.rb#L36 > > https://github.com/yast/yast-installation/blob/fd94cd1477a4807a8fee6b50c95a97fac0860629/src/lib/installation/ssh_key.rb#L62 > >> The only optimization could be probably possible when the user selects to >> not copy >> the keys. In that case we could drop the loaded keys when the installation >> starts. >> But that's not the default so this improvement would actually help only in >> some cases... >> >> ## TODO >> >> You can collect a different statistics from the data, e.g. the place which >> creates >> the most objects, which methods, check the object "age" (the GC generation >> value), etc... >> >> >> >> [1] http://tmm1.net/ruby21-objspace/ >> [2] https://trello.com/c/QJ2PHxjs >> [3] https://bugzilla.suse.com/show_bug.cgi?id=974601 >> [4] https://gist.github.com/lslezak/6b99026b7ea9e163cdfd5a6d6d0aca6c > -- Ancor González Sosa YaST Team at SUSE Linux GmbH -- To unsubscribe, e-mail: [email protected] To contact the owner, e-mail: [email protected]
