以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  WebBrowser内存问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=76299)

--  作者:ycli368
--  发布时间:2015/10/26 16:50:00
--  WebBrowser内存问题
Dim web As New system.windows.forms.WebBrowser
web.ScriptErrorsSuppressed = True

能在使用过程中释放内存吗
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.ComponentModel.Win32Exception: 存储空间不足,无法处理此命令。
   在 System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
   在 System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
   在 System.Drawing.BufferedGraphicsContext.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
   在 System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
   在 System.Drawing.BufferedGraphicsContext.Allocate(IntPtr targetDC, Rectangle targetRectangle)
   在 System.Windows.Forms.Control.WmPaint(Message& m)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

--  作者:大红袍
--  发布时间:2015/10/26 16:59:00
--  

什么情况下报错的?只要执行了上面的代码就报错?

 

你肯定new了很多次对象吧?每次用完,要把其消除。如

 

web.Dispose


--  作者:ycli368
--  发布时间:2015/10/26 17:00:00
--  
new了一次,循环打开几十个页面
--  作者:ycli368
--  发布时间:2015/10/26 17:01:00
--  
能处理完完关闭连接不,Native的链接用完关掉是不是就释放了
--  作者:大红袍
--  发布时间:2015/10/26 17:54:00
--  

你肯定是循环new了,用完要释放掉。

 

做例子来测试。