Problem solved. It turned out the program "my_rec" has statically big array declared at the first line. Python somehow changes the stacksize limit to very small (~2M ?), so that the array could not be allocated in stack. Is it a bug in python to change the stacksize? or is it just a RedHat 6.2 problem?