functions that could fill java heap space

1 view (last 30 days)
BSi
BSi on 3 Aug 2015
Edited: Walter Roberson on 7 Aug 2015
Hello there,
I'm trying to read measurement data from a CPU via tcpip communication in Matlab and process and save the data afterwards. My system configuratoin is:
  • Win 7, 64 bit, I5 with 4GB main memory
  • Matlab version R2013b (8.2.0.701), java 1.8.0_51
Unfortunatley after a few hours of program runtime the java heap space gets filled. So I increased the heap space memory as recommended and implemented the function java heap cleaner to flush the heap space regularly. I also checked on the used heap space memory with java.lang.Runtime.getRuntime and it gets filled over time (inspite of jheapcl), but doesn't reach the maximum setted size. And Matlab still crashed with the error message:
...
at java.awt.GraphcisConfiguration.createCompatibleImage(Unknown Source)
at java.awt.GraphcisConfiguration.createCompatibleImage(Unknown Source)
at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
And extracted part with the basic functions of my code is added. I do not process large data amounts (data is about 500x15 matrix). Could maybe one of the functions fwrite or dlmwrite create ojbcets, which are stored in the heap and do not get cleared by jheapcl? If so, how you I avoid this?
I read a few causes for a similar error message but I'am pretty sure that those causes can be excluded in my case.
I'd appreciate your help! Best regards
  2 Comments
Dasharath Gulvady
Dasharath Gulvady on 5 Aug 2015
Could you provide some more insight on the code?
  • For how many iterations does the while loop run?
  • What are variables text_start, stress etc? What is the size of these variables?
  • Does reducing the number of iterations in the loop make any difference?
Also, does increasing the Java heap size make any difference?
Walter Roberson
Walter Roberson on 7 Aug 2015
Edited: Walter Roberson on 7 Aug 2015
Make sure you delete() all of your objects. Use onCleanup() to prevent graphics objects from escaping the routines you intend them to be in.
Also see http://undocumentedmatlab.com/blog/matlab-java-memory-leaks-performance which might be for a version earlier than you are using

Sign in to comment.

Answers (0)

Categories

Find more on Performance and Memory in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!