Questionable use of theard.Thread creat using CreatThread rather than _beginthread.
Boundschecker的详细说明如下:
      A thread, which makes calls to one or more run-time library functions, was created using CreateThread. A thread that uses functions from the C run-time libraries should use the _beginthread and _endthread C run-time functions for thread management rather than CreateThread and ExitThread. Failure to do so results in small memory leaks when ExitThread is called.Note: If the run-time library is statically linked and the module lacks debug info, it may not be possible for the call to _beginthread to be detected and this error is reported. In this situation, the error can be safely suppressed.我不知道实时库函数和c实时库的函数有什么区别?而且我还没开新线程就已经检测出错误了。我用的
AfxBeginThread();开启线程,属于上面哪一类?请高手执教!

解决方案 »

  1.   

    检查一下线程代码等
    好像AfxBeginThread有时是会提示有泄漏,设置m_bAutoDelete = TRUE;
      

  2.   

    首先我还是要重复我以前说的:不要尽信BoundsChecker的信息。因为微软的很多API细节BoundsChecker不可能知道,它不可能完全的监视内存。
      

  3.   

    其次我要说的是:_beginthread是C运行期库中的函数,其最终还是调用Windows的API CreateThread生成线程的。上面那句话的意思就是让你直接调用Windows API而不使用C运行期函数。
      

  4.   

    如果线程里面没有调用C的runtime库就不用理它。用了的话就要改用beginthread来开启线程。
      

  5.   

    oyljerry:能否详细讲一下怎么用m_bAutoDelete检查代码?
    vcleaner(我没当大哥很久了.......) :谢谢指点!请问什么是c运行期函数?
      

  6.   

    使用线程有误.线程是使用 CreatThread 来创建的, 但你应该使用 _beginthread.Boundschecker的详细说明如下:
    有一个调用了C运行时函数的线程,是用CREATETHREAD创建的.需要调用C运行时的线程应该使用 _beginthread 和 _endthread 来创建和结束,而不是用 CreateThread 和 ExitThread.如果不这样,那么在 调用 ExitThread 的时候会有内存泄漏.
    总之,你最好使用 _beginthread 来创建线程,而不是AFXBEGINTHREAD和createthread.
    另外,_endthread会在线程退出时被自动调用,你不需要手动调用.