This is the mail archive of the 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]

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.



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