binblockwrite - MATLAB:Jav​a:GenericE​xception on large datasets

Hi all,
when trying to upload large datasets to a signal generator with binblockwrite out of the Instrument Control Toolbox, we're running into trouble.
Starting with a buffer size of 20 MB or larger (uint8 data type) binblockwrite exits on line 159 with a "MATLAB:Java:GenericException". At first glance it looks like the corresponding binblockwrite Java method is invoked there and throws the exception if the buffer size roughly exceeds the 20 megs limit.
We already tried to increase Java Heap and PermGen sizes in a java.opts file, but had no luck so far:
-XX:PermSize=200m
-XX:MaxPermSize=200m
-Xmx512m
-Dcom.sun.management.jmxremote
If monitored by VisualVM you can see the following reactions if binblockwrite is invoked:
- PermGen size: no / little change
- Heap size: increases roughly with output buffer size
Thanks a lot for any suggestions,
Philipp
---------
Versions:
Matlab 7.9.0 (R2009b)
Java SE Runtime Environment, 1.6.0_12
Windows XP SP3

 채택된 답변

Philipp
Philipp 2012년 4월 20일

1 개 추천

Ok, problem solved, you really have to have a close look on the OutputBufferSize settings (count your trailing zeros...) . If the output buffer has the right size to hold all the data, binblockwrite works just fine.
However, in such applications it's not uncommon that the buffer data has to be treated in Matlab before it is uploaded to an external instrument. So both the contiguous memory size within Matlab and the Java heap size (binblockwrite.m actually calls a binblockwrite Java method out of an instrument control toolbox class) have to be large enough to hold the data. If the Java heap size is too small for the application it can be adjusted in a java.opts file:
Otherwise a Java heap overrun is provoked and binblockwrite exits with a java.lang.OutOfMemory exception.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2012년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by