This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Ensure entries pid_map are initialized to NULL


On Wed, Aug 5, 2009 at 2:21 PM, Diego Novillo<dnovillo@google.com> wrote:
> On Wed, Aug 5, 2009 at 14:33, Neil Vachharajani<nvachhar@google.com> wrote:
>
>> --- gcc/value-prof.c.orig ? ? ? ?2009-08-04 17:10:24.000000000 -0700
>> +++ gcc/value-prof.c ?2009-08-05 11:29:26.638405003 -0700
>> @@ -1059,8 +1059,7 @@
>> ? if (pid_map != NULL)
>> ? ? return;
>>
>> - ?pid_map
>> - ? ?= (struct cgraph_node**) xmalloc (sizeof (struct cgraph_node*) *
>> cgraph_max_pid);
>> + ?pid_map = XCNEWVEC (struct cgraph_node*, cgraph_max_pid);
>
> I've just noticed that we never free pid_map. ?What would be a good
> place to do that? ?This is not related to this change, so if you find
> a good spot, it can be done in a separate patch.

This is not uncommon for objects with global life time. Other examples
include cgraph nodes, varpool nodes etc. I don't think it matters, but
it probably can be freed in toplev.c:finalize().

David

>
>
> Diego.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]