欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mtalab 运行问题:java.lang.OutOfMemoryError:Java heap space

程序员文章站 2022-06-13 21:34:41
...
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at java.awt.image.DataBufferInt.<init>(Unknown Source)
	at java.awt.image.Raster.createPackedRaster(Unknown Source)
	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(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)
	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
	at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
	at java.awt.Component.createVolatileImage(Unknown Source)
	at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
	at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
	at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
	at java.awt.Component.createBufferStrategy(Unknown Source)
	at java.awt.Window.createBufferStrategy(Unknown Source)
	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
	at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
	at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
	at javax.swing.RepaintManager.paint(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
	at java.awt.Container.paint(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
??? Error using ==> print at 310
Error using ==> get
Invalid handle object.

Error in ==> saveas at 159
        print( h, name, ['-d' dev{i}] )


matlab运行时出现的问题,解决方法:


1:Java heap space不足,增加分配的Java heap space, 在Preferences->General->Java Heap Memory。或者在采集过程中及时关闭打开的图像。

2:在C:\Users\$username$\AppData\Roaming\MathWorks\MATLAB\R2013a目录下,找到matlab.prf文件。。。编辑模式下在最后一行添加 


JavaMemHeapMax=I190000