This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Libiberty functions
Dave Korn wrote on 03/08/07 07:30:
> (Also, bear in mind that if you want your new pass to work correctly with
> pre-compiled headers, you really ought to be using Gcc's garbage-collected
> memory management facilities. See
> http://gcc.gnu.org/onlinedocs/gccint/Type-Information.html#Type-Information
> for the full gory details....)
That's not right. GCC does not use GC memory everywhere, passes can
also heap-allocate and/or use obstacks. You do have to be careful when
mixing heap-allocated with GC memory, but for pass-local memory
allocation schemes, heap and obstacks are perfectly fine.
Paulo, you may also want to use the XNEW/XCNEW wrapper macros. They are
handy shorthand wrappers around malloc.
Another convenient way of allocating a pool of memory is to use obstacks
(See libiberty/obstack.c).