[Python-Dev] stack check on Unix: any suggestions? (original) (raw)

M.-A. Lemburg mal@lemburg.com
Tue, 29 Aug 2000 22:24:00 +0200


Skip Montanaro wrote:

MAL> The C program can suck memory in large chunks and consume great MAL> amounts of stack, it just doesn't dump core... (don't know what I'm MAL> doing wrong here). Are you overwriting all that memory you malloc with random junk? If not, the stack and the heap may have collided but not corrupted each other.

Not random junk, but all 1s:

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.) ?!

-- Marc-Andre Lemburg


Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/