用IE的同志看看,用ACTIVEX的同志看看——by CJ(50分)

  • 主题发起人 主题发起人 CJ
  • 开始时间 开始时间
C

CJ

Unregistered / Unconfirmed
GUEST, unregistred user!
This is Courtesy of the guys at http://www.egroups.com/group/delphi-webbrowser/
If you import the msinternet controls, drop a browser on a form and navigate to a few location, then check GDI memory, you'll find you are loosing some, do the same after implementing the following and it's a lot less of a leek... however it's still there. I have actually switched to using CBC4 for this type of work.



Type TOleControlFix = class(TOleControl)

//Private
//Protected

procedure WMPaint(var Message: TWMPaint)
message WM_PAINT

function GetIUnknownProp(Index: Integer): IUnknown

function GetIDispatchProp(Index: Integer): IDispatch

end


implementation

procedure TOleControlFix.WMPaint(var Message: TWMPaint)

var
PS: TPaintStruct

begin
if Message.DC = 0 then begin
BeginPaint(Handle, PS)

EndPaint(Handle, PS)

endend


function TOleControlFix.GetIDispatchProp(Index: integer): IDispatch

var
Temp: TVarData


begin
GetProperty(Index, Temp)

// Result := IDispatch(Temp.VDispatch);// this caused //memory leak
Pointer(Result) := Temp.VDispatch
// changed to this
end


function TOleControlFix.GetIUnknownProp(Index: Integer): IUnknown;var
Temp: TVarData

begin
GetProperty(Index, Temp)

//Result := IUnknown(Temp.VUnknown)
// this caused //memory leak
Pointer(Result) := Temp.VUnknown
// changed to this to //avoid extra addref
end

end.
 
:cj 你该换行,否则,不回答问题,
 
呵呵,简单解释一下,在EXEX看到的:
用ACTIVEX会导致内存泄露,比如,你IMPORT一个IE的ACTIVEX,然后使用之
内存会泄露,用我以上的代码可以减少泄露,但不是杜绝,所以有人转BDB了
希望大家注意一下而已。
怎么出了50???我按,其它的呀???
 
那就再送50吧,嘻嘻
 
是Bug吗?
 
看来又有分了,xixi...
 
谁给个详细的测试报告就给分。
 
谁吧分还我?
实验了,的确有内存泄露,每次2%
 
我自己测试了,的确有这个问题!谁把分还我呀:(((
 
请教这个问题在CBC4中能否实现杜绝而不只是减少,
如何实现?
 
我朋友说BCB没这毛病。
 
按他的修改可以吗?
 
泄露还是有的,不过好点:(
 

Similar threads

A
回复
0
查看
992
Andreas Hausladen
A
A
回复
0
查看
973
Andreas Hausladen
A
I
回复
0
查看
651
import
I
后退
顶部