[Python-Dev] stack check on Unix: any suggestions?

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Tue, 29 Aug 2000 22:40:16 +0200


mal wrote:
> int recurse(int depth)
> {
>     char buffer[2048];
>     memset(buffer, 1, sizeof(buffer));
> 
>     /* Call recursively */
>     printf("%d\n",depth);
>     recurse(depth + 1);
> }
> 
> main()
> {
>     recurse(0);
> }
> 
> Perhaps I need to go up a bit on the stack to trigger the
> collision (i.e. go down two levels, then up one, etc.) ?!

or maybe the optimizer removed your buffer variable?

try printing the buffer address, to see how much memory
you're really consuming here.

     printf("%p %d\n", buffer, depth);

</F>