4.63 FAQ-942 Origin Slows Down or Uses An Excessive Amount of Memory When Importing via Origin C or LabTalk

Last Update: 6/7/2018

If you have written Origin C or LabTalk code to import multiple files in a loop and are experiencing a dramatic slowdown or dramatically increased memory usage, it is most likely related to the mechanism Origin uses to enable Undo of importing.

To remedy these issues, you can temporarily turn off Undo support by setting the @UN system variable to 0 before importing and restore it afterwards.

To do it in Origin C, use code similar to this example function:

void DoImport()
{
    // This class sets a system variable to a new value
    // while storing the old value.
    // When the instance of the class goes out of scope,
    // the instance is destroyed and the system variable
    // restored to it's previous value.
 
   LTVarTempChange junk("@UN", 0);

   // Perform all importing in same scope as above class instance until done.
}

To do it in LabTalk:

// Save current value of @UN.
int nOld = @UN;

// Turn off Undo.
@UN = 0;

// Perform all importing until done.

// Finally restore previous value of @UN.
@UN = nOld;



Keywords:LabTalk,Origin C,import,multiple,many,files,loop,speed,slow,memory