Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
64bits and memory problem

Subject: 64bits and memory problem

From: ste me

Date: 14 Oct, 2009 20:20:19

Message: 1 of 19

I recently shifted to Ubuntu@64bits and I have a problem with Matlab r2009a&memory.

The code makes use of a C file which is compiled via
>mex name.c

In a 32bits architecture everything is fine.
Under 64 bits the file is correctly compiled, but the programs stops with the error
Function "mxGetIr_700" is obsolete in file "compat32.cpp", line
282.
(64-bit mex files using sparse matrices must be rebuilt with the
"-largeArrayDims" option. See the R2006b release notes for more
details.)

I then compiled using the suggested option:

>mex -largeArrayDims name.c

and in this case I have an "out of memory" error.

The system has 4Gb of RAM, 4Gb of swap and the system monitor gives about 1Gb of used RAM while running Matlab...so I guess the problem is related to the quantity of ram allocated to Matlab.

Any idea?

Subject: 64bits and memory problem

From: Stan Bischof

Date: 14 Oct, 2009 20:25:10

Message: 2 of 19

ste me <mail.plutus@gmail.com> wrote:
> I recently shifted to Ubuntu@64bits and I have a problem with Matlab
> r2009a&memory.
>
> The code makes use of a C file which is compiled via
>>mex name.c
>
> In a 32bits architecture everything is fine. Under 64 bits the file is
> correctly compiled, but the programs stops with the error

Perhaps a silly question - but are you running the 64-bit
version of Matlab?

Stan

Subject: 64bits and memory problem

From: James Tursa

Date: 14 Oct, 2009 20:52:01

Message: 3 of 19

"ste me" <mail.plutus@gmail.com> wrote in message <hb5bq3$frt$1@fred.mathworks.com>...
> I recently shifted to Ubuntu@64bits and I have a problem with Matlab r2009a&memory.
>
> The code makes use of a C file which is compiled via
> >mex name.c
>
> In a 32bits architecture everything is fine.
> Under 64 bits the file is correctly compiled, but the programs stops with the error
> Function "mxGetIr_700" is obsolete in file "compat32.cpp", line
> 282.
> (64-bit mex files using sparse matrices must be rebuilt with the
> "-largeArrayDims" option. See the R2006b release notes for more
> details.)
>
> I then compiled using the suggested option:
>
> >mex -largeArrayDims name.c

Just using the -largeArrayDims flag doesn't fix the code for 64-bit. For example, if your name.c code is using int for array sizes instead of mwSize, mwSignedIndex, etc. etc. then the code will not work if any of those are passed by reference to a function (i.e., passing an address of an int to a routine that is expecting the address of an 8-byte unsigned integer for a size will obviously not work). The function would get garbage when it dereferenced the pointer, and if subsequently used as an agument for a memory allocation I could see how you might get an "out of memory" error. How large is your code ... short enough to post?

James Tursa

Subject: 64bits and memory problem

From: ste me

Date: 14 Oct, 2009 21:02:03

Message: 4 of 19

I am of course using the 64bits version of Matlab ;)

concerning the C code, it's not mine but it's a routine found on the internet. Before posting here, I contacted the author of the routine who confirmed to me that the code should also work under the 64bits architecture.

I'll ask the author of the code to intervene here..

Subject: 64bits and memory problem

From: Sebastiaan

Date: 14 Oct, 2009 21:31:03

Message: 5 of 19

"ste me" <mail.plutus@gmail.com> wrote in message <hb5e8b$oli$1@fred.mathworks.com>...
> I am of course using the 64bits version of Matlab ;)
>
> concerning the C code, it's not mine but it's a routine found on the internet. Before posting here, I contacted the author of the routine who confirmed to me that the code should also work under the 64bits architecture.
>
> I'll ask the author of the code to intervene here..

I believe it worked until 2008a or so...

Subject: 64bits and memory problem

From: Rascal Oo

Date: 21 Oct, 2009 18:56:04

Message: 6 of 19

Hello all,
I am also getting the same problem.
The error looks:

??? Error using ==> svmtrain
Function "mxGetIr_700" is obsolete in file ".\compat32.cpp", line 282.
(64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. See the
R2006b release notes for more details.)

I am using win64 with matlab 64 edition.
this happen to me when i try to use svm to do some classification model.

I am sort of nobe in matlab and any help is much appreciated.

Rascal

Subject: 64bits and memory problem

From: Rascal Oo

Date: 21 Oct, 2009 18:59:04

Message: 7 of 19

Hi all,
I am also getting the same error like the following:

??? Error using ==> svmtrain
Function "mxGetIr_700" is obsolete in file ".\compat32.cpp", line 282.
(64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. See the
R2006b release notes for more details.)

Got no idea to carry on.
I'm using matlab64 on win64.
Sort of beginner to matlab and any help is much appreciated.

Rascal

Subject: 64bits and memory problem

From: bobzheng zheng

Date: 1 Nov, 2009 19:19:01

Message: 8 of 19

"Rascal Oo" <auto.tho@googlemail.com> wrote in message <hbnllo$qv1$1@fred.mathworks.com>...
> Hi all,
> I am also getting the same error like the following:
>
> ??? Error using ==> svmtrain
> Function "mxGetIr_700" is obsolete in file ".\compat32.cpp", line 282.
> (64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. See the
> R2006b release notes for more details.)
>
> Got no idea to carry on.
> I'm using matlab64 on win64.
> Sort of beginner to matlab and any help is much appreciated.
>
> Rascal

I also have this problem...

Subject: 64bits and memory problem

From: Shiguo

Date: 18 Nov, 2009 20:33:05

Message: 9 of 19

"bobzheng zheng" <bobzheng1983@hotmail.com> wrote in message <hckmv5$s48$1@fred.mathworks.com>...
> "Rascal Oo" <auto.tho@googlemail.com> wrote in message <hbnllo$qv1$1@fred.mathworks.com>...
> > Hi all,
> > I am also getting the same error like the following:
> >
> > ??? Error using ==> svmtrain
> > Function "mxGetIr_700" is obsolete in file ".\compat32.cpp", line 282.
> > (64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. See the
> > R2006b release notes for more details.)
> >
> > Got no idea to carry on.
> > I'm using matlab64 on win64.
> > Sort of beginner to matlab and any help is much appreciated.
> >
> > Rascal
>
> I also have this problem...

I am using svmtrain with a matlab64 (matlab 2009a) on win64. I got exactly the same problem... Has anyone found out the solution?

Subject: 64bits and memory problem

From: Shiguo

Date: 19 Nov, 2009 21:59:05

Message: 10 of 19

When I was using svmtrain in libsvm. I got this same problem. I write the software author (Chih-Jen Lin), he said that we need to modify make.m, add -largeArrayDims on 64-bit machines. So we need:

mex -O -largeArrayDims ...

now the make file is like this:

mex -O -largeArrayDims -c svm.cpp
mex -O -largeArrayDims -c svm_model_matlab.c
mex -O -largeArrayDims svmtrain.c svm.obj svm_model_matlab.obj
mex -O -largeArrayDims svmpredict.c svm.obj svm_model_matlab.obj
mex -O -largeArrayDims libsvmread.c
mex -O -largeArrayDims libsvmwrite.c

It fixed the problem. Enjoy~

P.S., the following FAQ says about the x64 compiler when installing visual studio c.

Q: On 64bit Windows I compile the MATLAB interface without problem, but why errors occur while running it?

If you use Microsoft Visual Studio, probabally it is not properly installed. See the explanation here.
 http://www.mathworks.com/support/compilers/R2009b/win64.html;jsessionid=Ls87LF1JH1RnLp18kQdqtzvQGvw29Q4w26dJJn9JpzwZxCGNN7T4!-1681277526#n7

Subject: 64bits and memory problem

From: James

Date: 11 Jan, 2010 13:15:22

Message: 11 of 19

"Shiguo " <jiangshiguo@gmail.com> wrote in message <he4f39$c64$1@fred.mathworks.com>...
> When I was using svmtrain in libsvm. I got this same problem. I write the software author (Chih-Jen Lin), he said that we need to modify make.m, add -largeArrayDims on 64-bit machines. So we need:
>
> mex -O -largeArrayDims ...
>
> now the make file is like this:
>
> mex -O -largeArrayDims -c svm.cpp
> mex -O -largeArrayDims -c svm_model_matlab.c
> mex -O -largeArrayDims svmtrain.c svm.obj svm_model_matlab.obj
> mex -O -largeArrayDims svmpredict.c svm.obj svm_model_matlab.obj
> mex -O -largeArrayDims libsvmread.c
> mex -O -largeArrayDims libsvmwrite.c
>
> It fixed the problem. Enjoy~
>
> P.S., the following FAQ says about the x64 compiler when installing visual studio c.
>
> Q: On 64bit Windows I compile the MATLAB interface without problem, but why errors occur while running it?
>
> If you use Microsoft Visual Studio, probabally it is not properly installed. See the explanation here.
> http://www.mathworks.com/support/compilers/R2009b/win64.html;jsessionid=Ls87LF1JH1RnLp18kQdqtzvQGvw29Q4w26dJJn9JpzwZxCGNN7T4!-1681277526#n7

I was originally getting this error:
"Function "mxGetIr_700" is obsolete in file "compat32.cpp", line 246.
(64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. ...)"

But I've still got this problem, even when I compile my GibbsSamplerAT.cpp file with the -largeArrayDims flag.

GibbsSamplerAT.cpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
GibbsSamplerAT.cpp:265: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
GibbsSamplerAT.cpp:266: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
GibbsSamplerAT.cpp:385: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
GibbsSamplerAT.cpp:386: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
GibbsSamplerAT.cpp:417: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
GibbsSamplerAT.cpp:418: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment

Here are lines 265 and 266:
irad = mxGetIr(prhs[2]);
jcad = mxGetJc(prhs[2]);

, where 'irad' and 'jcad' are defined as *int. I tried casting them to mwIndex*, but got further errors.

Someone at this link http://www.stanford.edu/~dgleich/programs/matlab_bgl/faq.html said to "update to Matlab BGL 2.1 which includes precompiled files for 64-bit linux with support for largeArrayDims included". I have no idea how to do this. I downloaded the BGL, but I have no idea how to install it.

I'm totally stumped. Any help much appreciated.

Subject: 64bits and memory problem

From: James

Date: 20 Jan, 2010 16:15:26

Message: 12 of 19

Hi guys,

Thanks for the replies.

I managed to solve this problem by simply converting all problematic mwIndex* arrays to int* arrays.

Took me about a day, but at least it works now.

Subject: 64bits and memory problem

From: evan Rosen

Date: 8 Mar, 2010 21:08:06

Message: 13 of 19

James <hynese@cs.tcd.ie> wrote in message <1712131673.21252.1264004162359.JavaMail.root@gallium.mathforum.org>...
> Hi guys,
>
> Thanks for the replies.
>
> I managed to solve this problem by simply converting all problematic mwIndex* arrays to int* arrays.
>
> Took me about a day, but at least it works now.

I was looking through this discussion due to an issue with the Griffiths and Steyvers topic modeling toolbox and your errors look almost identical to mine. I am trying to use the GibbsSamplerLDA function and I thought I'd see if were possible to use your updated version or at least give me some pointers.

thanks

Subject: 64bits and memory problem

From: James

Date: 29 Mar, 2010 17:28:44

Message: 14 of 19

Hi Evan,
The problem is probably b/c you're on a Linux or Mac and they gcc,
which is slightly more finicky than other compilers. You need to
modify the lines in the Gibbs Sampler code where they randomly
generate a number and add "ULL" (without quotes). So a problematic
line such as the one below becomes (notice the ULL after 4294967296)
i_pick = i_start + (int) ( (double) randomMT() * (double) nauthors /
(double) (4294967296 + 1.0) );
i_pick = i_start + (int) ( (double) randomMT() * (double) nauthors /
(double) (4294967296ULL + 1.0) );

I am assuming you have a 32-bit machine.
James

On Mar 8, 4:08 pm, "evan Rosen" <emro...@stanford.edu> wrote:
> James <hyn...@cs.tcd.ie> wrote in message <1712131673.21252.1264004162359.JavaMail.r...@gallium.mathforum.org>...
> > Hi guys,
>
> > Thanks for the replies.
>
> > I managed to solve this problem by simply converting all problematic mwIndex* arrays to int* arrays.
>
> > Took me about a day, but at least it works now.
>
> I was looking through this discussion due to an issue with the Griffiths andSteyverstopic modelingtoolboxand your errors look almost identical to mine.  I am trying to use the GibbsSamplerLDA function and I thought I'd see if were possible to use your updated version or at least give me some pointers.
>
> thanks

Subject: 64bits and memory problem

From: Swagatika

Date: 29 Nov, 2012 08:54:20

Message: 15 of 19

Thanks. This helped me fix my problem :)

Subject: 64bits and memory problem

From: Jagvaral

Date: 16 Sep, 2013 08:54:06

Message: 16 of 19

"James Tursa" wrote in message <hb5dlg$g5k$1@fred.mathworks.com>...
> "ste me" <mail.plutus@gmail.com> wrote in message <hb5bq3$frt$1@fred.mathworks.com>...
> > I recently shifted to Ubuntu@64bits and I have a problem with Matlab r2009a&memory.
> >
> > The code makes use of a C file which is compiled via
> > >mex name.c
> >
> > In a 32bits architecture everything is fine.
> > Under 64 bits the file is correctly compiled, but the programs stops with the error
> > Function "mxGetIr_700" is obsolete in file "compat32.cpp", line
> > 282.
> > (64-bit mex files using sparse matrices must be rebuilt with the
> > "-largeArrayDims" option. See the R2006b release notes for more
> > details.)
> >
> > I then compiled using the suggested option:
> >
> > >mex -largeArrayDims name.c
>
> Just using the -largeArrayDims flag doesn't fix the code for 64-bit. For example, if your name.c code is using int for array sizes instead of mwSize, mwSignedIndex, etc. etc. then the code will not work if any of those are passed by reference to a function (i.e., passing an address of an int to a routine that is expecting the address of an 8-byte unsigned integer for a size will obviously not work). The function would get garbage when it dereferenced the pointer, and if subsequently used as an agument for a memory allocation I could see how you might get an "out of memory" error. How large is your code ... short enough to post?
>
> James Tursa

Hi, I have exactly the same problem as you mention. First, I add '-largeArrayDims' option but it caused another problem saying that out of memory. How can I fix this problem? Do you think it is because of matlab version? I really need help please.

Subject: 64bits and memory problem

From: Steven_Lord

Date: 16 Sep, 2013 15:30:21

Message: 17 of 19



"Jagvaral " <selmee006@gmail.com> wrote in message
news:l16gve$ln0$1@newscl01ah.mathworks.com...
> "James Tursa" wrote in message <hb5dlg$g5k$1@fred.mathworks.com>...
>> "ste me" <mail.plutus@gmail.com> wrote in message
>> <hb5bq3$frt$1@fred.mathworks.com>...
>> > I recently shifted to Ubuntu@64bits and I have a problem with Matlab
>> > r2009a&memory.
>> >
>> > The code makes use of a C file which is compiled via
>> > >mex name.c
>> >
>> > In a 32bits architecture everything is fine.
>> > Under 64 bits the file is correctly compiled, but the programs stops
>> > with the error
>> > Function "mxGetIr_700" is obsolete in file "compat32.cpp", line
>> > 282.
>> > (64-bit mex files using sparse matrices must be rebuilt with the
>> > "-largeArrayDims" option. See the R2006b release notes for more
>> > details.)
>> >
>> > I then compiled using the suggested option:
>> >
>> > >mex -largeArrayDims name.c
>>
>> Just using the -largeArrayDims flag doesn't fix the code for 64-bit. For
>> example, if your name.c code is using int for array sizes instead of
>> mwSize, mwSignedIndex, etc. etc. then the code will not work if any of
>> those are passed by reference to a function (i.e., passing an address of
>> an int to a routine that is expecting the address of an 8-byte unsigned
>> integer for a size will obviously not work). The function would get
>> garbage when it dereferenced the pointer, and if subsequently used as an
>> agument for a memory allocation I could see how you might get an "out of
>> memory" error. How large is your code ... short enough to post?
>>
>> James Tursa
>
> Hi, I have exactly the same problem as you mention. First, I add
> '-largeArrayDims' option but it caused another problem saying that out of
> memory. How can I fix this problem? Do you think it is because of matlab
> version? I really need help please.

Read the suggestions in this section of the documentation:

http://www.mathworks.com/help/matlab/matlab_prog/resolving-out-of-memory-errors.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: 64bits and memory problem

From: Jagvaral

Date: 17 Sep, 2013 06:47:09

Message: 18 of 19

"ste me" wrote in message <hb5bq3$frt$1@fred.mathworks.com>...
> I recently shifted to Ubuntu@64bits and I have a problem with Matlab r2009a&memory.
>
> The code makes use of a C file which is compiled via
> >mex name.c
>
> In a 32bits architecture everything is fine.
> Under 64 bits the file is correctly compiled, but the programs stops with the error
> Function "mxGetIr_700" is obsolete in file "compat32.cpp", line
> 282.
> (64-bit mex files using sparse matrices must be rebuilt with the
> "-largeArrayDims" option. See the R2006b release notes for more
> details.)
>
> I then compiled using the suggested option:
>
> >mex -largeArrayDims name.c
>
> and in this case I have an "out of memory" error.
>

Hello, Did you solve this problem? I have the exactly same error as yours. I am stuck in it. I really need help? I am writing my thesis using a toolbox (bnt). It has some mex file. When I call the mex file. It shows an error saying that matlab is running out of memory.


> The system has 4Gb of RAM, 4Gb of swap and the system monitor gives about 1Gb of used RAM while running Matlab...so I guess the problem is related to the quantity of ram allocated to Matlab.
>
> Any idea?

Subject: 64bits and memory problem

From: Yong

Date: 2 Oct, 2013 09:39:07

Message: 19 of 19

"James " <hynese@cs.tcd.ie> wrote in message <hif89a$p3q$1@fred.mathworks.com>...
> "Shiguo " <jiangshiguo@gmail.com> wrote in message <he4f39$c64$1@fred.mathworks.com>...
> > When I was using svmtrain in libsvm. I got this same problem. I write the software author (Chih-Jen Lin), he said that we need to modify make.m, add -largeArrayDims on 64-bit machines. So we need:
> >
> > mex -O -largeArrayDims ...
> >
> > now the make file is like this:
> >
> > mex -O -largeArrayDims -c svm.cpp
> > mex -O -largeArrayDims -c svm_model_matlab.c
> > mex -O -largeArrayDims svmtrain.c svm.obj svm_model_matlab.obj
> > mex -O -largeArrayDims svmpredict.c svm.obj svm_model_matlab.obj
> > mex -O -largeArrayDims libsvmread.c
> > mex -O -largeArrayDims libsvmwrite.c
> >
> > It fixed the problem. Enjoy~
> >
> > P.S., the following FAQ says about the x64 compiler when installing visual studio c.
> >
> > Q: On 64bit Windows I compile the MATLAB interface without problem, but why errors occur while running it?
> >
> > If you use Microsoft Visual Studio, probabally it is not properly installed. See the explanation here.
> > http://www.mathworks.com/support/compilers/R2009b/win64.html;jsessionid=Ls87LF1JH1RnLp18kQdqtzvQGvw29Q4w26dJJn9JpzwZxCGNN7T4!-1681277526#n7
>
> I was originally getting this error:
> "Function "mxGetIr_700" is obsolete in file "compat32.cpp", line 246.
> (64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. ...)"
>
> But I've still got this problem, even when I compile my GibbsSamplerAT.cpp file with the -largeArrayDims flag.
>
> GibbsSamplerAT.cpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
> GibbsSamplerAT.cpp:265: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
> GibbsSamplerAT.cpp:266: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
> GibbsSamplerAT.cpp:385: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
> GibbsSamplerAT.cpp:386: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
> GibbsSamplerAT.cpp:417: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
> GibbsSamplerAT.cpp:418: error: cannot convert ‘mwIndex*’ to ‘int*’ in assignment
>
> Here are lines 265 and 266:
> irad = mxGetIr(prhs[2]);
> jcad = mxGetJc(prhs[2]);
>
> , where 'irad' and 'jcad' are defined as *int. I tried casting them to mwIndex*, but got further errors.
>
> Someone at this link http://www.stanford.edu/~dgleich/programs/matlab_bgl/faq.html said to "update to Matlab BGL 2.1 which includes precompiled files for 64-bit linux with support for largeArrayDims included". I have no idea how to do this. I downloaded the BGL, but I have no idea how to install it.
>
> I'm totally stumped. Any help much appreciated.
If really works for the win64 + matlab 64bit platform, Thanks a lot.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us