我的程序在 debug 下执行正常,但是在 release 后执行就会出现Runtime ErrorR6016
- not enough space for thread data请问这个错误信息是什么回事?

解决方案 »

  1.   

    为何在 debug 版本中又能正常运行呢?没人理我?
      

  2.   

    C Run-Time Error R6016
    not enough space for thread dataThe program did not receive enough memory from the operating system to complete a _beginthread call.When a new thread is started, the library must create an internal database for the thread. If the database cannot be expanded with memory provided by the operating system, the thread will not begin and the calling process will stop
      

  3.   

    这段我也看了,可是为何在 debug 版本中又没事?而且 msdn 上没说怎么解决
      

  4.   

    更奇怪的是我这样注释掉开启线程的语句后
    //m_pThread = AfxBeginThread(NewThreadGetResuilt,this,THREAD_PRIORITY_BELOW_NORMAL,0,CREATE_SUSPENDED);
    //m_pThread->m_bAutoDelete=FALSE;
    //m_pThread->ResumeThread();依然出现同样错误!!!!
    除非连线程函数里的代码全部注释掉,才能运行,为什么?
      

  5.   

    我怀疑你的线程函数有问题,可以的话贴出来看一下.//按照你提供的部分代码,我做了如下测试未见异常.
    //Declare member variable m_pThread in MainFrm.h
    CWinThread *m_pThread; 
    //Declare thread function in MainFrm.cpp
    UINT NewThreadGetResuilt( LPVOID pParam );//the function is realized by your provider
    void CMainFrame::OnTest() 
    {
      m_pThread= AfxBeginThread(NewThreadGetResuilt,this,THREAD_PRIORITY_BELOW_NORMAL,0,CREATE_SUSPENDED);
      m_pThread->m_bAutoDelete=FALSE;
      m_pThread->ResumeThread();
    }//the thread function;
    UINT NewThreadGetResuilt( LPVOID pParam )
    {
       AfxMessageBox("Maybe this function has some question!");
       return 0L;
    }
      

  6.   

    UINT NewThreadGetResuilt( LPVOID pParam ); 错
    应该是 UINT __stdcall NewThreadGetResuilt( LPVOID pParam );