ROS with Simulink : Exception in thread "ROS Executor Thread": java.lang.​OutOfMemor​yError: Direct buffer memory

1 次查看(过去 30 天)
I use simulink connect with ROS. However, it always report error after a while ( about 2400 seconds)
Exception in thread "ROS Executor Thread": java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:694)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$Preallocation.<init>(SocketSendBufferPool.java:158)
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool.<init>(SocketSendBufferPool.java:40)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.<init>(AbstractNioWorker.java:123)
at org.jboss.netty.channel.socket.nio.NioWorker.<init>(NioWorker.java:44)
at org.jboss.netty.channel.socket.nio.NioWorkerPool.createWorker(NioWorkerPool.java:34)
at org.jboss.netty.channel.socket.nio.NioWorkerPool.createWorker(NioWorkerPool.java:26)
at org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool.<init>(AbstractNioWorkerPool.java:58)
at org.jboss.netty.channel.socket.nio.NioWorkerPool.<init>(NioWorkerPool.java:29)
at org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory.<init>(NioClientSocketChannelFactory.java:149)
at org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory.<init>(NioClientSocketChannelFactory.java:114)
at org.ros.internal.transport.tcp.TcpClient.<init>(TcpClient.java:71)
at org.ros.internal.transport.tcp.TcpClientManager.connect(TcpClientManager.java:67)
at org.ros.internal.node.topic.DefaultSubscriber.addPublisher(DefaultSubscriber.java:158)
at org.ros.internal.node.topic.UpdatePublisherRunnable.run(UpdatePublisherRunnable.java:73)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The simulink model is shown as below ,include one rospublisher(geomeory_msg/Point) and two rossubsribers(geomeory_msg/PointStamped, geomeory_msg/PoseStamped):

回答(1 个)

Himanshu
Himanshu 2024-9-12
Hey,
The error 'java.lang.OutOfMemoryError: Direct buffer memory' means MATLAB is running out of Java Heap memory. To work around this issue simply increase the Java Heap using the following documentation link:
This issue can occur when using a computer screen with many pixels (e.g. very high resolution screen). The reason for this is that MATLAB must allocate enough memory in the Java Heap to account for all the pixels a figure takes. As such, when there are a lot of pixels, the amount of memory necessary is higher. While MATLAB's default heap size is sufficient in most cases, in cases where the total number of pixels is high (e.g. very high resolution screens, multiple screens, etc.) a larger heap size may be necessary.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 ROS Log Files and Transformations 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by