Back to the main page.

Bug 883 - bdf files persisting in memory

Reported 2011-08-18 11:39:00 +0200
Modified 2012-02-03 21:34:54 +0100
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: All
Operating System: All
Importance: P1 major
Assigned to: Robert Oostenveld
Depends on:
See also:

Vladimir Litvak - 2011-08-18 11:39:28 +0200

On Thu, Aug 18, 2011 at 1:39 AM, Bill Budd <> wrote: > Dear Vladimir > > I've noticed when using spm_eeg_convert to convert bdf files that the bdf > file persists in memory after the spm_eeg_convert function or even the > script calling it has finished. Not sure if the issue is specific to my > scripting or the spm/fieldtrip functions. Wondered if you have any advice as > it uses a lot of memory while the rest of the script pipeline runs. The only > way I can seem to clear it is to run 'clear all mex' or exit matlab, but > really need some less sledge-hammer style solution to clearing it from RAM. > > Cheers > -Bill >

Robert Oostenveld - 2011-12-14 12:02:31 +0100

I suspect this due to the general memory management of matlab. Looking into the mex file I see that is uses mxCallc. According to my own knowledge and that should result in MATLAB freeing the memory again. In the m file there are no persistent or global variables being used, so the memory cannot stick (otherwise than matlab general being sloppy in clearing the data). To speed up MATLAB from freeing the memory, I will do an explicit mxFree in the read_24bit and read16_bit mex files. manzana> svn commit Sending src/read_16bit.c Sending src/read_16bit.mexmaci64 Sending src/read_24bit.c Sending src/read_24bit.mexmaci64 Transmitting file data .... Committed revision 5037.

Boris Reuderink - 2012-02-03 21:34:54 +0100

Apparently the mex-files for other platforms still need to be recompiled. But I am closing this bug, finding outdated mex-files is already another bug.