wchar_t* headFileWCHAR = new wchar_t[headLen];
wchar_t* srcFileWCHAR = new wchar_t[srcLen];
memset(headFileWCHAR,0,sizeof(wchar_t)*headLen);
memset(srcFileWCHAR,0,sizeof(wchar_t)*srcLen); wcsncpy(headFileWCHAR,prjPath,p-prjPath+1);
wcsncpy(srcFileWCHAR,prjPath,p-prjPath+1); wcscat(headFileWCHAR,headFile.GetBSTR());
wcscat(srcFileWCHAR,srcFile.GetBSTR()); _bstr_t headFileBstrT(headFileWCHAR);
_bstr_t srcFileBstrT(srcFileWCHAR);=============================
这里_bstr_t 的构造函数内是个宽字符数租,按照MSDN,应该是他把这个数组COPY进自己的空间内的,也就是他自己也拥有和这个数组相等的数组。
但是我接下来调用delete []headFileWCHAR 的时候却总是出现运行时错误,我查了一下好像也没有内存泄漏,难道他没有COPY????、
wchar_t* srcFileWCHAR = new wchar_t[srcLen];
memset(headFileWCHAR,0,sizeof(wchar_t)*headLen);
memset(srcFileWCHAR,0,sizeof(wchar_t)*srcLen); wcsncpy(headFileWCHAR,prjPath,p-prjPath+1);
wcsncpy(srcFileWCHAR,prjPath,p-prjPath+1); wcscat(headFileWCHAR,headFile.GetBSTR());
wcscat(srcFileWCHAR,srcFile.GetBSTR()); _bstr_t headFileBstrT(headFileWCHAR);
_bstr_t srcFileBstrT(srcFileWCHAR);=============================
这里_bstr_t 的构造函数内是个宽字符数租,按照MSDN,应该是他把这个数组COPY进自己的空间内的,也就是他自己也拥有和这个数组相等的数组。
但是我接下来调用delete []headFileWCHAR 的时候却总是出现运行时错误,我查了一下好像也没有内存泄漏,难道他没有COPY????、
“其实内部只是headFileBstrT的成员::SysAllocString(headFileWCHAR);并没有对headFileWCHAR做什么
”
啥啊