Sign in to follow this  
Followers 0
Jdop

_IENavigate causing embedded IE to consume huge amounts of memory

17 posts in this topic

#1 ·  Posted (edited)

This has been reported a few times, but I could not find a usable solution to this nasty problem.

Using Windows 7 X64, 4 gig ram. Autoit ver 3.3.4

Attached is a proof of concept. I embed an IE object in a tabbed Gui, and _IENavigate to the same website every 10 seconds (Wall St Journal home page).

Initial memory usage is about 100 meg, already high but I could live with it. Every reload causes additional memory to be consumed and after a very short time 500 meg is used. I let it run for about 15 minutes and 1 GIG!!!!! is consumed. Very ugly.

Easily seen in Task manager.

This is only a portion of my actual code, so the Gui buttons dont work, but the actual Web Page is viewable on the second Tab named 'Web Page' (too small in this snippet to see in its entirety).

I have tried destroying the gui (supposedly this also destroys an embedded IE object) and recreating it within the code, but this did not free up memory as I might have expected.

I tested reloading the page using IE itself, and do not see this memory leak issue in the native app.

Anyone have a workaround for this ?

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GuiTab.au3>









    $AlertTabbed = GUICreate("Web Alert", 504, 374, 378, 583, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_CLIPCHILDREN, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    ;GUISetIcon("D:\005.ico")
    $PageControl1 = GUICtrlCreateTab(10, 10, 487, 315)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Alert")

    $Alerttext = GUICtrlCreateInput("Alerttext", 32, 56, 441, 60)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")

    $ChangedTextLabel = GUICtrlCreateEdit("", 32, 120, 449, 193, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))

    GUICtrlSetData(-1, "ChangedText")
    GUICtrlSetFont(-1, 10, 400, 0, "Arial")

    $TabSheet2 = GUICtrlCreateTabItem("Web Page")
    $oIE = _IECreateEmbedded()
    $GUIActiveX = GUICtrlCreateObj($oIE, 15, 25, @DesktopWidth - 350, @DesktopHeight - 350)

    $TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
    GUICtrlCreateTabItem("")
    $TabButton1 = GUICtrlCreateButton("&OK", 12, 335, 93, 31, $WS_GROUP)
    $TabButton2 = GUICtrlCreateButton("&Cancel", 111, 335, 92, 31, $WS_GROUP)
    $TabButton3 = GUICtrlCreateButton("&Help", 404, 335, 92, 31, $WS_GROUP)
    $OpenInBrowser = GUICtrlCreateButton("Open In Browser", 212, 336, 108, 31, $WS_GROUP)
    GUICtrlSetBkColor(-1, 0xC0DCC0)

GUISetState(@SW_SHOW)


$TimerStart=TimerInit()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $TabButton1
            ExitLoop

    EndSelect

    If TimerDiff($TimerStart)>10000 Then
        _IENavigate($oIE,"http://online.wsj.com/home-page")
        $TimerStart=TimerInit()
    EndIf
WEnd

Webloadtest.au3

Edited by Jdop

Share this post


Link to post
Share on other sites



I don't recall seing anything like this reported before.

What version of IE?

Is it an iexplore.exe process that grows in memory usage or your AutoIt script process?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I ran this for quite a few minutes. Memory stayed flatlined, however, CPU usage jumped up and down the whole time.

Win7 x64

2GB

Edited by jaberwocky6669

Share this post


Link to post
Share on other sites

I don't recall seing anything like this reported before.

What version of IE?

Is it an iexplore.exe process that grows in memory usage or your AutoIt script process?

Dale

Here's another thread on a similar issue.

It's the Autoit script that shows the memory usage, AutoIt3_x64.exe when run from scite editor.

Using IE 8.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I ran this for quite a few minutes. Memory stayed flatlined, however, CPU usage jumped up and down the whole time.

Win7 x64

2GB

That's quite odd. I have nothing unusual about my setup, and no other problems related to this. I tried changing the refresh settings in IE to Automatic, from 'reload on every refresh' , to no avail.

I ran few more tests, it seems the content of the Web site is the issue. I have some sites that do not cause this problem at all, after repeated navigates.

That doesn't explain why jaberwocky6669 is not seeing the same problem

Edited by Jdop

Share this post


Link to post
Share on other sites

My recommendation would be the same as what I suggested in the other thread you reference:

Assuming you run it outside the GUI and it doesn't happen, it could be an issue with the GUI object container in AutoI. Suggest you investigate an alternate method by searching for IECreate2 in the forum to attach a full browser instance instead of using the GUI container.

Dale

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

updated to the latest autoit version 3.3.6.1 , no change.

removed flash, thinking that may be the culprit. no change.

Each ienavigate adds about 6 to 8 meg of memory to the 'working set' in Task Manager

I'm only seeing this extreme usage on the wsj.com home page. But two here have said it does not chew up memory on their configurations.

I'd really like to figure out where this leak is coming from.

Share this post


Link to post
Share on other sites

I just left it running for 10 minutes, the highest it went is 50MB, but still drops also.

Mine starts at 100 mb, so right there something odd is going on.

Share this post


Link to post
Share on other sites

Mine starts at 100 mb, so right there something odd is going on.

I'm not certain about that, I dont know if it uses ram based on your total and I only have 1GB.

Is that the whole script you are testing it with, because like you say, its really odd behaviour.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

I'm not certain about that, I dont know if it uses ram based on your total and I only have 1GB.

Is that the whole script you are testing it with, because like you say, its really odd behaviour.

Well , I see the same behavior in my full script and the test script I posted.

No question its something embedded in the wsj home page which has quite a bit going on, as I have 3 or 4 other simpler web pages repeatedly loading and I don't see any leak at all with those.

Other than the Flash code, which I think I eliminated as the cause , I don't know what else could be the culprit. Maybe some javascript.

Share this post


Link to post
Share on other sites

I just ran this same test code in a VMWare virtual machine with a very basic install, and I see the EXACT SAME MEMORY BUG.

This pretty much nails it for me, and I don't know how anyone else running an x64 box is not having the problem.

Share this post


Link to post
Share on other sites

I think I found a workaround for this. Will report later

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

The reason for the difference between JohnOnes 50MB and Jdops 100MB is the simple fact that 64 bit systems require twice as much RAM to perform the same operations.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0