POSIX thread runs out of memory

i am creating threads in my program using the POSIX interface.
when the thread starts executing i run out of memory and get a core dump.

i have tried to increase the threads stack size using pthread_attr_setstacksize, but of no use since i guess the dynamic memory is allocated on the heap and not on the stack.

how do i increase the heap size of my threads.

Exactly what error are you getting - on what platform?