How to increase java heap memory in a dll?

조회 수: 13 (최근 30일)
Alicia Camara Roldan
Alicia Camara Roldan 2019년 5월 22일
답변: Alicia Camara Roldan 2019년 5월 22일
I am downloading a big amount of information from a database, using this code:
conn = database(odbc,'','');
strsql = "whatever"
curs = exec(conn,strsql);
It only works after increasing the Java Heap Memory in the MATLAB General Preferences. This is ok if I run the code in my computer, but the problem is that I need to generate a dll to download the information from other computers that do not have matlab. The dll is running an out of Java Memory Problem. What can I do?
Thank you in advance.

답변 (2개)

Jan
Jan 2019년 5월 22일
I cannot check it with a compiled application. But inside Matlab you can hack the preferences file. At first check the current heap size:
heapSize = java.lang.Runtime.getRuntime.maxMemory;
If the heap size is too small, set a new value:
com.mathworks.services.Prefs.setIntegerPref('JavaMemHeapMax', 2048); % MB
and restart the program. This works with restarting Matlab, e.g. by
system('matlab')
quit;
But I have no idea hoe to restart the DLL.

Alicia Camara Roldan
Alicia Camara Roldan 2019년 5월 22일
Thank you for your answer.
That's what I did with the preferences, and it worked inside Matlab, but not with the compiled application.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by