From: Ashley P. <as...@qu...> - 2006-10-20 10:34:16
|
On Fri, 2006-10-20 at 11:16 +0100, Julian Seward wrote: > On Friday 20 October 2006 11:04, Ashley Pittman wrote: > > On Fri, 2006-10-20 at 10:41 +0100, Julian Seward wrote: > > > Are you sure you're not trying to allocate too much stuff onto the stack? > > > 3.2.1 allows you a max stack of 16M and you get to segfault after that. > > > > Is this limitation something that's here to stay? I've not spotted it > > as a problem but I'm a few months behind head-of-tree currently. > > Well, it's been like that for quite a long time now, probably since > 3.1.0 at least. It's not a recent change. Is it causing you or > potentially causing you a problem? I know that Fortran HPC folks > tend to complain about it from time to time as putting huge arrays > on the stack is apparently a culturally acceptable thing to do in > Fortran-world, but apart from it doesn't seem to cause many problems. It's exactly those people I was thinking of, it's not something I do myself but I have seen stacks measured in Gb. More of a potential problem that a real one. One reproducer I had sent to me recently was this one: int main() { unsigned long eqs[1309732]; g_elanBaseP = elan_baseInit(0); printf ("elan_baseInit returned: %#lx\n", g_elanBaseP); return 0; } As it turns out in this case the problem was a simple ulimit one but it goes to show that people really do try some unexpected things. Valgrind seems to get this mostly right but does complain when elan_baseInit() tries to read it's parameter (a 64 bit int). It also seems to get the line numbers wrong on ia64, base.c only has 864 lines, 857 is the } closing the elan_baseInit() function. I'll try and get together a reproducer for this second issue. on ia32 valgrind shows this: ==4376== Warning: client switching stacks? SP change: 0xBEFFF9E8 --> 0xBEB00934 ==4376== to suppress, use: --max-stackframe=5238964 or greater ==4376== Invalid write of size 4 ==4376== at 0x80484B2: main (test.c:8) ==4376== Address 0xBEB00934 is on thread 1's stack ==4376== ==4376== Invalid read of size 4 ==4376== at 0x4063F00: elan_baseInit (base.c:593) ==4376== Address 0xBEB00934 is on thread 1's stack ==4376== Warning: set address range perms: large range 134225920 (readable) ==4376== Warning: set address range perms: large range 134225920 (readable) ==4376== Warning: set address range perms: large range 134217728 (readable) ==4376== Warning: client switching stacks? SP change: 0xBEB00930 --> 0xBEFFF9E8 ==4376== to suppress, use: --max-stackframe=5238968 or greater on ia64 it shows this: ==17920== Warning: client switching stacks? SP change: 0x7FF0008A0 --> 0x7FE602778 ==17920== to suppress, use: --max-stackframe=10477864 or greater ==17920== Invalid write of size 8 ==17920== at 0x400638: main (test.c:8) ==17920== Address 0x7FE602778 is on thread 1's stack ==17920== Warning: set address range perms: large range 134225920 (defined) ==17920== Warning: set address range perms: large range 134225920 (defined) ==17920== Warning: set address range perms: large range 134217728 (defined) ==17920== ==17920== Invalid read of size 8 ==17920== at 0x4B5B5AC: elan_baseInit (base.c:857) ==17920== Address 0x7FE602778 is on thread 1's stack ==17920== Warning: client switching stacks? SP change: 0x7FE602780 --> 0x7FF0008A0 ==17920== to suppress, use: --max-stackframe=10477856 or greater ==17920== Ashley, |