Delphi OleVariant自动转换String 疑似SysString泄漏

有如下声明,假设V已赋值
var V:OleVariant;
 
如下代码似乎会造成内存泄漏
SysUtil.Pos('finish.html', V);
VarToStr(V);
 
原因猜测:
SysUitl.Pos要求的第二个参数为String, 那么程序运行时把V:OleVariant自动转换为String, 调用堆栈如下
Routine Name               Class Name              Source Line            Source File           Module Name
SysAllocStringLen                                              0                                            OLEAUT32.DLL
SysAllocStringLen                                              0                                            QASCLIENT.EXE
WStrFromPWCharLen                                          0                                            QASCLIENT.EXE
WStrCopy                                                         0                                            QASCLIENT.EXE
VarToLStr                                                         0                                            QASCLIENT.EXE
TWebWindow::BrowserBeforeNavigate2 TWebWindow 130           frmWebWindow.pas  QASCLIENT.EXE (上边事例代码Pos调用位置)
暂时不明

你可能感兴趣的:(html,Delphi)