This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: The bloat sweepstakes...
On Sun, Oct 07, 2001 at 08:44:50PM +0200, guerby@acm.org wrote:
> The String buffer in Lib.Utils should be around 580KB, not sure why it is
> showing up at 2MB?
-- from lib-util.adb:
Max_Line : constant Natural := 2 * Hostparm.Max_Name_Length + 64;
Max_Buffer : constant Natural := 1000 * Max_Line;
Info_Buffer : String (1 .. Max_Buffer);
-- from hostparm.ads:
Max_Name_Length : constant := 1024;
so, (2 * 1024 + 64) * 1000 = 2112000 bytes = 2062.5K.
Sure enough,
$ nm lib-util.o | grep info_buffer
00203a00 C lib__util__info_buffer
and hex 203a00 = decimal 2112000.
> All GNAT compiler IO is done by fast and low level routines, dependancies over
> Ada.Text_IO would bring piles of complicated runtime stuff into the
> compiler, and we don't want that (plus it would probably be slower :).
Makes sense.
Surely there's some form of dynamic allocation you could use for this,
though. Or just not buffering the file in such huge chunks? C stdio
tends to use buffers on the order of a memory page...
zw