Choose Language Hide Translation Bar
Community Trekker

Ran out of memory, during the script.

Version 7.0.2: 2 GB memory, Windows 7

I have a for loop (that loops twice for now). Within the for loop I open a database connection and query a get a returned table. The returned table is about 10 columns, 1.7M rows. I then save the table and close it, and then on to the next table. The issue is the memory is never released from the first table, so when fetching the records from the next loops query, I get a memory exception. Is there a way to permanently close the table and its memory from within the for loop? Thanks Chris.

Please see code snippet below:

myList = words(Munger(p["wafers"],z,","," ")); //puts wafer numbers into a list

N = N Items(myList); // counts the number of wafers in the list

for (i=1, i<=N, i++,  

     waf_id = myList[i];

     waf_table = myList[i];

     if(length(waf_id) > 0 , waf_id="('" || waf_id || "')" );

     ls_sql = "SELECT * ";

     ls_sql = ls_sql || "  FROM WDBP.dbo.SF_QST ";

     ls_sql = ls_sql || " WHERE WAFER_ID IN " || waf_id

     show(ls_sql); // shows the SQL statement in the log

     OpenDatabase("DSN=WDBP;UID=WDFREP;PWD=wdfrep;",ls_sql,waf_table); // queries the database

     dt = data table(waf_table);

    filename = waf_table||".jmp";


    close(dt, save(filename));


0 Kudos
Community Trekker

Ran out of memory, during the script.

OK. Issue is solved by placing a "wait(5)" command after the "close(dt, save(filename))" at the end of the loop. JMP had not completed the filesave, before the script went on for further processing.

I found this by performing some tests, and dumb luck..

0 Kudos