Delphi-TSevenZipVCL中的内存泄漏

Delphi-TSevenZipVCL中的内存泄漏,delphi,memory-leaks,7zip,Delphi,Memory Leaks,7zip,使用madhi的madExcept和组件TSevenZipVCL()测试内存泄漏。此处报告泄漏: POleStr = PWideChar; TBStr = POleStr; function TSevenZip.List: Integer; ... for i := 0 to w - 1 do begin name := new( TBSTR ); <------- ptype := 0; in

使用madhi的madExcept和组件TSevenZipVCL()测试内存泄漏。此处报告泄漏:

  POleStr = PWideChar;
  TBStr = POleStr;
    function TSevenZip.List: Integer;
    ...
      for i := 0 to w - 1 do
      begin
        name := new( TBSTR ); <-------
        ptype := 0;
        inA.GetPropertyInfo( i, name, prop, pType );
POleStr=PWideChar;
TBStr=POleStr;
函数TSevenZip.List:整数;
...
对于i:=0到w-1 do
开始
名称:=新(TBSTR);
此函数似乎在第一个参数中传递了一个索引,并且通过其他参数返回具有该索引的属性的信息。编写您调用的代码的人对
IInArchive
接口的翻译非常糟糕。函数如下所示:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;

C++声明看起来像这样:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
name
参数是在函数中分配并返回给调用方的COM BSTR

我想这样宣布:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
通过这样做,您将确保编译器能够在处理完COM BSTR后解除对其的分配

您应该删除对
New
的调用。这完全是假的

此函数似乎在第一个参数中传递了一个索引,并且通过其他参数返回具有该索引的属性的信息。编写您调用的代码的人对
IInArchive
接口的翻译非常糟糕。函数如下所示:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;

C++声明看起来像这样:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
name
参数是在函数中分配并返回给调用方的COM BSTR

我想这样宣布:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
通过这样做,您将确保编译器能够在处理完COM BSTR后解除对其的分配

您应该删除对
New
的调用。这完全是假的

此函数似乎在第一个参数中传递了一个索引,并且通过其他参数返回具有该索引的属性的信息。编写您调用的代码的人对
IInArchive
接口的翻译非常糟糕。函数如下所示:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;

C++声明看起来像这样:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
name
参数是在函数中分配并返回给调用方的COM BSTR

我想这样宣布:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
通过这样做,您将确保编译器能够在处理完COM BSTR后解除对其的分配

您应该删除对
New
的调用。这完全是假的

此函数似乎在第一个参数中传递了一个索引,并且通过其他参数返回具有该索引的属性的信息。编写您调用的代码的人对
IInArchive
接口的翻译非常糟糕。函数如下所示:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;

C++声明看起来像这样:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
name
参数是在函数中分配并返回给调用方的COM BSTR

我想这样宣布:

function GetPropertyInfo( index: DWORD; var name: TBSTR; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
function GetPropertyInfo( index: DWORD; out name: WideString; var propID: PROPID; 
    var varType: {PVARTYPE}Integer ): Integer; stdcall;
通过这样做,您将确保编译器能够在处理完COM BSTR后解除对其的分配


您应该删除对
New
的调用。这完全是假的。

你需要展示更多细节。什么是接口,函数调用的协议是什么?不要瞎做这件事?您必须理解代码在做什么。我猜打电话给New是假的。但不能确定。将完整单元发布到您需要显示更多详细信息。什么是接口,函数调用的协议是什么?不要瞎做这件事?您必须理解代码在做什么。我猜打电话给New是假的。但不能确定。将完整单元发布到您需要显示更多详细信息。什么是接口,函数调用的协议是什么?不要瞎做这件事?您必须理解代码在做什么。我猜打电话给New是假的。但不能确定。将完整单元发布到您需要显示更多详细信息。什么是接口,函数调用的协议是什么?不要瞎做这件事?您必须理解代码在做什么。我猜打电话给New是假的。但不能确定。发布了完整的单元以感谢它的工作。从你发布的另一个问题开始,现在只剩下BTMemoryModule泄漏。谢谢你的帮助。从你发布的另一个问题开始,现在只剩下BTMemoryModule泄漏。谢谢你的帮助。从你发布的另一个问题开始,现在只剩下BTMemoryModule泄漏。谢谢你的帮助。现在,在您发布的另一个问题中,只剩下BTMemoryModule泄漏。