From owner-svn-src-all@FreeBSD.ORG Thu Jul 10 05:57:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D4517D6C; Thu, 10 Jul 2014 05:57:20 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 662E12488; Thu, 10 Jul 2014 05:57:19 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 5C53D7836A2; Thu, 10 Jul 2014 15:57:18 +1000 (EST) Date: Thu, 10 Jul 2014 15:57:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/gd... In-Reply-To: <20140709182745.GD93733@kib.kiev.ua> Message-ID: <20140710153824.S985@besplex.bde.org> References: <201407091552.s69FqUon070685@svn.freebsd.org> <53BD68E4.1070706@freebsd.org> <20140709172305.GD56040@ivaldir.etoilebsd.net> <20140709182745.GD93733@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dZS5gxne c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=pz_-lglE43cA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=6I5d2MoRAAAA:8 a=DFdQTo3ctmNjKJFgGzoA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , Baptiste Daroussin , Pedro Giffuni , "svn-src-head@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2014 05:57:21 -0000 On Wed, 9 Jul 2014, Konstantin Belousov wrote: > On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote: >> On 9 July 2014 10:23, Baptiste Daroussin wrote: >>> On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote: >>>> Hi, >>>> >>>> By doing this you're actually making more work for the really embedded >>>> people who have size constraints on things. >>>> >>>> I dislike privatelib but it at least allows for code sharing where >>>> before people would just statically link things into binaries. >>> >>> do you install gdb on your embedded environnement? because that is the only >>> user of libreadline. >> >> See below. >>>> >>>> I've had to actively undo this kind of dumb before in order to get >>>> things to fit on very small flash root filesystems. >>>> >>>> Shared libraries are good. Please stop assuming we have lots of disk >>>> space and RAM to have duplicates of things floating around. Shared libraries are not good. They save a little disk space but cost an enormous amount of RAM. E.g.: FreeBSD-~5.2 i386, statically linked: PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 1101 bde 1 76 0 1392K 780K RUN 0:00 0.00% top FreeBSD-11 i386, dynamically linked: PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAN 25085 bde 1 21 0 11260K 2432K STOP 4 0:00 0.00% top Here dynamic linkage and perhaps other bloat takes 3 times as much RAM (RES) and 8 times as much virtual memory (SIZE). For long-running programs, even more RAM (or swap to the disk that you apparently don't have on embedded systems), it is likely for more of the shared library virtual memory to be written to so that it becomes physical. This might explain the even larger RAM uses in the following: FreeBSD-~5.2 i386, statically linked: PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 681 root 1 76 0 1676K 1132K select 0:00 0.00% sshd 659 root 1 44 r0 848K 536K select 0:00 0.00% ntpd 688 root 1 76 0 2084K 1796K select 0:00 0.00% sendmail FreeBSD-11 i386, dynamically linked: PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAN 25072 bde 1 20 0 17836K 6556K select 1 0:00 0.00% sshd 693 root 1 20 0 12356K 4168K select 4 0:02 0.00% ntpd 744 root 1 20 0 12868K 4752K select 0 0:01 0.00% sendma Here dynamic sshd takes almost 6 times as much RAM; dynamic ntpd almost 8 times as much, but dymamic sendmail takes less than 3 times as much. The output also shows misformatting of the USERNAME column in newer versions of FreeBSD (lots of unused whitespace to kill the command name non-whitespace). However, I would like the option to link any library shared, in case I want to optimize disk space at the cost of RAM and runtime. > What Baptiste did is the only correct way to handle the ABI and API > un-stability issues with the third-party libraries. The change is > good if only for this sole reason. Private libraries still conflict > with the same library installed by other means, in the single process > image. Works even better for libc :-). Static libraries also insulate from the latest bloat and security holes. There main problem is that they give old security holes instead. Bruce