Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memory leak
Message
From
10/02/2006 07:41:59
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01095329
Message ID:
01095403
Views:
10
Hi John,
Try being even more explicit by releasing the object after you're done with it in each iteration & see if it fixes your memory leak.
release oXLPage
Also, without seeing the actual code, I'm currious, the variable is called oXLPage, but what actual excel object is it? Application, workbook, sheet? I assume by the naming, that it's a sheet, well then is there also an application and workbook object that you have assigned to a variable out there somewhere? Could there theorhetically be Excel application objects out there that you did not explicitly create that continue to eat up memory? Perhaps try something like this & see what happens.
LOCAL oExcel, oWorkbook, oSheet

oExcel = createObject("Excel.Application")
with oExcel
    .sheetsInNewWorkbook = 1
    .displayAlerts = .f.
    oWorkbook = .workbooks.add()
    SELECT TheCursorWithTheDataInIt
    SCAN
        oSheet = oWorkbook.sheets.add()
        && DO WORK WITH oSheet HERE
        release oSheet
    ENDSCAN
endwith
with oWorkbook
    .saveas(whatever)
    .close()
endwith
oExcel.quit()
release oSheet
release oWorkbook
release oExcel
>Folks
>
>I'm running an app that creates pages of HTML using Office automation (graphic objects created on an Excel worksheet and saved in web format). This iterates to create an entire website and takes about 2 hours to run, in the form:
>
>
>SELECT TheCursorWithTheDataInIt
>SCAN
>  oXLPage = CREATEOBJECT("DoOnePageThingy", param1, param2 ...)
>ENDSCAN
>
>
>Only trouble is, there's a memory leak somewhere. I start with a memory usage of about 350Mb on my 1Gb system and by about 1/3 of the way through memory usage has risen to >1.5Gb and my system grinds to a halt. When I close Excel manually, memory usage drops just for the Excel instance. When I close VFP9, I recover >1Gb of memory, so I'm pointing at the VFP part of my app.
>
>I assume the object oXLPage above should be garbage collected on each iteration, but to be more explicit I have tried this form:
>
>
>SELECT TheCursorWithTheDataInIt
>SCAN
>  = Do1Page(param1, param2 ...)
>ENDSCAN
>
>PROC Do1Page
>LPARAMETERS param1, param2 ...
>* the var goes out of scope more explicitly here
>LOCAL oXLPage
>oXLPage = CREATEOBJECT("DoOnePageThingy", param1, param2 ...)
>ENDPROC
>
>
>However, no improvement. Any clues that may relate to var scope, Autoyield, DOEVENTS etc?
>
>John Burton
Paul A. Busbey
Victoria Insurance
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform