This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Question about memory allocation in ifcvt.c
- From: thorsten <fly_b747 at gmx dot de>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 14 Oct 2012 10:05:03 +0200
- Subject: Question about memory allocation in ifcvt.c
Hello all,
this might be a noob Question but perhaps someone is so kind as to shed
some light...
using gcc-4.5.4 to build large files (as in wireshark or qemu) with
Optimizations enabled (in my case -O2 -pipe -march=core2
-fomit-frame-pointer) I get segmentation faults due to Stack limits,
when using the standard stacksize on linux.
I figured out that ifcvt.c uses alloca to reserve mem on the stack. this
is the point where the segmentation fault occurs.
So beeing curious, I changed alloca to xmalloc to use the heap instead
of the stack, thinking this is likely to cause a huge penalty in
compile-speed. But comparing both the gcc-alloca and gcc-xmalloc the
compiletimes do not differ significantly. And the gcc-xmalloc does not
crash anymore due to limited stackspace.
So here is my question: What is the reason for using alloca (Stack)
instead of xmalloc (heap) in ifcvt.c? I have seen, that also gcc-4.7.2
still uses alloca.
Thanks!
Thorsten