I have a project I\'m writing (in Java) for a class where the prof says we\'re not allowed to use more than 200m
I limit the stack memory to 50m (just to be absolutely sure)
I've often found it helps me track this stuff down. It will show you how much of each kind of memory is being used in even let you drill in and find out what.