I wander how to allocate space in a thread created using
AfxBeginThread(pFunc,param)?

I ever use the malloc function,sometimes it works,Otherwise
it will invoke a error.

It seems that no error occur if i use GlobalAlloc() function .
But I don't know the reason.

Who can tell me what on earth is the proper method to allocate
space dynamically in a thread?

I look forward to your response, thanks a lot!