读书人

这样是否会出现内存泄露解决方法

发布时间: 2012-03-31 13:13:26 作者: rapoo

这样是否会出现内存泄露

C/C++ code
............int a[3];int i=0;do{   cout<<"please enter a variable:";  cin>>a[i];  i++;    }while(i<3);........................int a[3];int i=0;do{   cout<<"please enter a variable:";  cin>>a[i];  i++;    }while(i<3);............;do{   cout<<"please enter a variable:";  cin>>a[i];  i++;    }while(i<3);............


这样调用
CWork::StartTask(hWnd);
释放
CWork::Release();

[解决办法]
会的
release之后delete对象
[解决办法]
不要用_endthread结束线程,直接return返回,然后CloseHandle
_endthread and _endthreadex cause C++ destructors pending in the thread not to be called.

另外,你这个写的有问题,如果StartWork两次或以上的话……

读书人网 >C++

热点推荐