I have "segmentation fault" in my code. I'm curious if I allocate some space using "malloc()" in a function. After the function finished, is the space still valid? Further question, when a create a child thread like this, I suppose it exists even after its parent exits. I'm using GCC in Linux.
void foo(){
void *child_stack;
child_stack=(void*)malloc(16384);
child_stack += 16384;
clone((void*)do_function,child_stack,0,NULL);
}