From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12967 invoked by alias); 10 Apr 2006 16:02:36 -0000 Received: (qmail 12959 invoked by uid 22791); 10 Apr 2006 16:02:36 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Apr 2006 16:02:34 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k3AG2U8N009307; Mon, 10 Apr 2006 12:02:31 -0400 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.11.6) with ESMTP id k3AG2T8w006924; Mon, 10 Apr 2006 12:02:29 -0400 Received: from [10.32.68.1] (vpn-68-1.surrey.redhat.com [10.32.68.1]) by pobox.surrey.redhat.com (8.12.8/8.12.8) with ESMTP id k3AG2MOk016791; Mon, 10 Apr 2006 17:02:24 +0100 Message-ID: <443A809F.4090006@redhat.com> Date: Mon, 10 Apr 2006 17:10:00 -0000 From: Nick Clifton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Kevin Nomura CC: binutils@sourceware.org Subject: Re: memory usage with large debug sections References: <20060405020342.GG9379@netapp.com> In-Reply-To: <20060405020342.GG9379@netapp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00148.txt.bz2 Hi Kevin, > if ((sec->flags & SEC_RELOC) != 0) > { > size_t ext_size; > > ext_size = elf_section_data (sec)->rel_hdr.sh_size; > if (ext_size > max_external_reloc_size) > max_external_reloc_size = ext_size; > if (sec->reloc_count > max_internal_reloc_count) > max_internal_reloc_count = sec->reloc_count; > } > > Is it really the case that the size of a debug section has > to be used to calculate the malloc size for these relocation > structures? No, but this size is guaranteed to be safe - there can never be more relocs in a debug section than if the entire section held relocs and nothing else. If you would like to try to improve this code you could write a function to count the number of relocs in the debug section and then use this figure in the malloc. Cheers Nick