Out of memory while loading model (only) in SDK 3.1

Hello forum,
after some months I redownload Jmonkeyengine (Version 3, SDK 3.1, windows) as I want to play and hobby a bit around with it in the following months. For this reason I bought a refurbished business laptop and installed Java, Jmonkey etc.

After opening Jmonkey the first thing I tried was to import a blender asset (*.blend file).
Unfortunately this failed and the system prompted with an “java heap space” exception.
Error message is here

[Error messages](https://imgur.com/a/pWng5)

I can not upload the *.Jpg pics to the forum it always says “Sorry, there was an error uploading that file. Please try again.”

Anyhow the error says:
java.lang.Outofmemoryerror at
com.jme3.texture.plugins.tgaloader.load(Tgaloader.java 205)

Jme3.scene.plugins.blender…
Jme3.asset…
Jme3.gde…

I tried several times and with different assets but I could not open any asset in the scene editor and
I could not convert a model to *.j3o files.

Finally I installed an older version of JMonkey (SDK 3.0 stable), that I used on my old scraped PC, and tried again. With this SDK everything worked fine. I could import and view the model and I could convert it to a *.j3o file.

Now, switching back to the new version of the SDK I tried to open the converted *.j3O file and it is working as well. Once the file is an *.j3o I can open and use it without any problem.
The only thing I realized is, that the SDKs may use different versions of Java (see details below).

I would like to ask some experts what might be (my) the problem here?
Why I can not import or convert assets in the new version of the SDK?

I am not an IT expert and “fresh” with JMonkey as well. I have not tried and installed the SDK on
any other PC to reproduce this behaviour.

Following are the versions of the SDKs and some of the settings and versions of my laptop.

SDK Version that give me errors:

Product Version: jMonkeyEngine SDK 3.1.0-stable-FINAL
Updates: Updates available to version NetBeans 8.2 Patch 2
Java: 1.8.0_111; Java HotSpot™ 64-Bit Server VM 25.111-b14
Runtime: Java™ SE Runtime Environment 1.8.0_111-b14
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (jmonkeyplatform)
User directory: C:\Users\Win7Pro64\AppData\Roaming.jmonkeyplatform\3.1.0-stable-FINAL
Cache directory: C:\Users\Win7Pro64\AppData\Roaming.jmonkeyplatform\3.1.0-stable-FINAL\var\cache

SDK Version that works fine:

Product Version: jMonkeyEngine SDK 3.0
Updates: Updates available
Java: 1.7.0_51; Java HotSpot™ 64-Bit Server VM 24.51-b03
Runtime: Java™ SE Runtime Environment 1.7.0_51-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (jmonkeyplatform)
User directory: C:\Users\Win7Pro64\AppData\Roaming.jmonkeyplatform\3.0
Cache directory: C:\Users\Win7Pro64\AppData\Roaming.jmonkeyplatform\3.0\var\cache

My PC:
Intel Core i5 -3230 CPU 2,6 Ghz (Lenovo Thinkpad, refurbished, fresh installed)

Graphic:
NVIDIA Systeminformationen
Name des Systems: WIN7PRO64-PC

[Anzeige]
Betriebssystem: Windows 7 Professional, 64-bit (Service Pack 1)
DirectX-Version: 11.0
GPU-Prozessor: NVS 5400M
Treiberversion: 345.20
Direct3D-API-Version: 11
Direct3D-Funktionsebene: 11_0
CUDA-Kerne: 96
Kerntakt (Core) 660 MHz
Shadertakt: 1320 MHz
Speicher-Datenrate: 1800 MHz
Speicherschnittstelle: 128-Bit
Speicherbandbreite: 28.80 GB/s
Gesamter verfügbarer Grafikspeicher: 4095 MB
Dedizierter Videospeicher: 1024 MB DDR3
System-Videospeicher: 0 MB
Freigegebener Systemspeicher: 3071 MB
Video-BIOS-Version: 70.08.A8.03.02
IRQ: 16
Bus: PCI Express x16 Gen2
Geräte-ID: 10DE 0DEF 21F517AA
Teilenummer: 1303 0000

[Komponenten]

nvui.dll 8.17.13.4520 NVIDIA User Experience Driver Component
nvxdsync.exe 8.17.13.4520 NVIDIA User Experience Driver Component
nvxdplcy.dll 8.17.13.4520 NVIDIA User Experience Driver Component
nvxdbat.dll 8.17.13.4520 NVIDIA User Experience Driver Component
nvxdapix.dll 8.17.13.4520 NVIDIA User Experience Driver Component
NVCPL.DLL 8.17.13.4520 NVIDIA User Experience Driver Component
nvCplUIR.dll 8.0.820.0 NVIDIA Control Panel
nvCplUI.exe 8.0.820.0 NVIDIA Control Panel
nvWSSR.dll 6.14.13.4520 NVIDIA Workstation Server
nvWSS.dll 6.14.13.4520 NVIDIA Workstation Server
nvViTvSR.dll 6.14.13.4520 NVIDIA Video Server
nvViTvS.dll 6.14.13.4520 NVIDIA Video Server
NVSTVIEW.EXE 7.17.13.4520 NVIDIA 3D Vision Photo Viewer
NVSTTEST.EXE 7.17.13.4520 NVIDIA 3D Vision Test Application
NVSTRES.DLL 7.17.13.4520 NVIDIA 3D Vision Module
nvDispSR.dll 6.14.13.4520 NVIDIA Display Server
NVMCTRAY.DLL 8.17.13.4520 NVIDIA Media Center Library
nvDispS.dll 6.14.13.4520 NVIDIA Display Server
NVCUDA.DLL 8.17.13.4520 NVIDIA CUDA 6.5.44 driver
nvGameSR.dll 6.14.13.4520 NVIDIA 3D Settings Server
nvGameS.dll 6.14.13.4520 NVIDIA 3D Settings Server

http://jmonkeyengine.github.io/wiki/sdk/increasing_heap_memory.html

This should actually Work. Its strange that 3.0 works because we raised that Limit for 3.1 I think but the importer might have become more Memory Hungry as well.

I can recommend you studying exporting xbuf Files from blender though since the blender Import might yield bugs for complex models (like unsupported modifiers when not applied)

I tried increasing the heap memory via config file.
I also installed the SDK 3.1. stable on another laptop.
I I tried to load 2 different models but the same error is returned on both of my laptops.

Finally I exported a simple box from blender as *.blend file. This file I could import.
So I believe there might be a problem with the initial files I tried to import.

@Darkchaos - I will read and try with xbuf files as recomended.
I still dont understand why it is working with the old SDk and not with the new but I think I will manage from here.
Thx

Old SDK used old blender plugin. New SDK uses newer blender plugin.

Old blender plugin could only read 5% of stuff from .blend files. Newer blender plugin can read maybe 9% now… probably using more memory.

(I’m probably being overly pessimistic on the percentages but the point is still relevant and .blend has to be close to the worst format to try and read in a game engine…)

What size is your model and/or the included textures? Because I can load 50MiB files (they have embedded textures) fine, with -Xmx of 2GiB (which might be the SDK default now).

So what are you trying to load which takes more than 2GB on Convert? Or maybe your system doesn’t have 2GiB so that Java drops back to 32MB?

I have downloaded the model (a zeppelin) from blendswap.com
Zeppelin
The blend file has a size of 6,8 MBs.

@pspeed I used blender to make a *.obj file from that blend. Then I could load it with SDK 3.1
Maybe it is a good advice to save the models in a different format as *.blend, seems to solve the problem here.

@Darkchaos the config settings (after fresh SDK installI) on my laptop are:
“Xmx512m -J-XX:MaxDirectMemorySize=2048m”
I am not sure how much storage this system realy has (the video driver see above the settings has 1024MB DDR, the whole graphic system has 4095 MB and I am unaware about some of the other figures).

As I have tried on a different laptop yesterday and faced the same problem with the *.blend file the problem realy might be with that file or format.
So again: Converting it to *.object seemed to have solved the problem here.

When I have some free time I can give that blendswap file a try, since converting to obj isn’t really an option since it has it’s own downsides (larger file size, less features, …).

512m might indeed be the problem. Check the real RAM (e.g. using the Task Manager or the Rightclick on Computer and Open the Properties).

Have you tried it with -Xmx2048m or -Xmx3096m? If you still have a problem with OutOfMemory something really strange is going on actually. Did you modify the blend from blendswap in any way?

Btw: If you are fine with the work you have to do for .obj, learn .xbuf, it’s 99% the exact same process but works better

I have tried with -Xmx2048m or -Xmx3096m
and this laptop has 8 GB RAM (more then 4 are available while writing here).
As I said I made a fresh install on another laptop and tried there.
After increasing the xmx to 3096 the following message appears in the SDK
“This file can not be loaded, it is either in an unsupported format or is incompatible.
Check the bottom right corner of the SDK for a little warning sign. If it is there double-click it and report the contained stack trace at jmonkeyengine.org.”

These are the error messages

Unable to load image using TGA loader!
Unable to load image using DDS loader!
Image could not be loaded by none of available loaders!
An Exception has occured when trying to load asset zeppelin01
com.jme3.asset.AssetLoadException: An exception has occured while loading asset: zeppelin01.blend
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:261)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
	at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
	at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:53)
	at com.jme3.gde.core.assets.AssetData.loadAsset(AssetData.java:130)
	at com.jme3.gde.modelimporter.ModelImporterVisualPanel3.loadModel(ModelImporterVisualPanel3.java:92)
	at com.jme3.gde.modelimporter.ModelImporterVisualPanel3.loadSettings(ModelImporterVisualPanel3.java:61)
	at com.jme3.gde.modelimporter.ModelImporterWizardPanel3.readSettings(ModelImporterWizardPanel3.java:82)
	at org.openide.WizardDescriptor.updateStateOpen(WizardDescriptor.java:867)
	at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:822)
	at org.openide.WizardDescriptor._updateState(WizardDescriptor.java:800)
	at org.openide.WizardDescriptor.goToNextStep(WizardDescriptor.java:1072)
	at org.openide.WizardDescriptor.access$1900(WizardDescriptor.java:92)
	at org.openide.WizardDescriptor$Listener$1.run(WizardDescriptor.java:2208)
	at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1516)
	at org.openide.WizardDescriptor.access$2000(WizardDescriptor.java:92)
	at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2227)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:487)
	at com.sun.proxy.$Proxy25.actionPerformed(Unknown Source)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.Component.processMouseEvent(Component.java:6533)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2236)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2294)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
	at java.awt.Container.dispatchEventImpl(Container.java:2280)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
	at java.awt.Dialog.show(Dialog.java:1084)
	at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1086)
	at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1136)
	at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1108)
	at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:131)
	at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.doEventAccess(NbMutexEventProvider.java:138)
	at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.readAccess(NbMutexEventProvider.java:98)
	at org.netbeans.modules.openide.util.LazyMutexImplementation.readAccess(LazyMutexImplementation.java:94)
	at org.openide.util.Mutex.readAccess(Mutex.java:218)
	at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1093)
	at java.awt.Component.show(Component.java:1671)
	at java.awt.Component.setVisible(Component.java:1623)
	at java.awt.Window.setVisible(Window.java:1014)
	at java.awt.Dialog.setVisible(Dialog.java:1005)
	at com.jme3.gde.modelimporter.ImportModel.actionPerformed(ImportModel.java:93)
	at org.openide.awt.AlwaysEnabledAction$1.run(AlwaysEnabledAction.java:199)
	at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
	at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
	at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
	at org.openide.awt.AlwaysEnabledAction.actionPerformed(AlwaysEnabledAction.java:202)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.Component.processMouseEvent(Component.java:6533)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2236)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2294)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
	at java.awt.Container.dispatchEventImpl(Container.java:2280)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.io.IOException: Unexpected importer exception occured: null
	at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:223)
	at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:88)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	... 124 more
Caused by: java.lang.NullPointerException
	at com.jme3.texture.Texture2D.<init>(Texture2D.java:63)
	at com.jme3.scene.plugins.blender.textures.TextureHelper.loadImageAsTexture(TextureHelper.java:253)
	at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:133)
	... 126 more

So the problem might not be that laptop but realy the file. Maybe it is that mysterious image?

Can you try to convert the model using SS Editor? :slight_smile:

Was in dialogue with @javasabr

  • converting the *.blend file works with his SS Editor
  • you can use it and then use the file in SDK
  • you can work with it inside the editor
1 Like

Okay so I had a look at the Model and it isn’t game ready for multiple purposes:
It has many geometries, which could all be only one geometry (so performance is degraded)
It uses Cycles Materials, which is bad because it cannot be so easily importert into jme. Jme needs conventional stuff like Textures.
It has the construction plan in it, which is useless data for a game, you won’t show that anyway.
It uses HDR Environments, probably this is the Texture which kills everything it terms of RAM.

Maybe SS Editor uses a new HDR Loader or a newer engine version?

Either way there is quite some work to do on that model to really use it in-game (which is generally the problem with blendswap/regular models, since they are made to be rendered)

yes, I use master branch of jME because from time to time I make PR’s with some changes in jME.

So I could reproduce the bug, but I also had to increase -Xmx from 2G (I just took 8G now), I guess SS Editor just has higher default values than the sdk.

What I can’t understand is why it works in SS Editor because:

Judging by TextureHelper.java:254 the NullPointerException happens when ImageLoader.loadImage yields null.

Looking at ImageLoader.loadImage:64 shows that we simply try to recognize the file as AWT, TGA, DDS.

Technically we should open a Pull Request using the new HDRLoader in this (though it’s not so useful since regular models shouldn’t have 360 degree environments: You don’t need them ingame and if you’d do, you’d manually load them).

JavaSaBr’s Commit 0e340416fdf399aec25da9711b501f081232abd9 did fix that kind of bug for files not packed into blender, but it didn’t for embedded files, which is what makes me wonder why it works.

I’m doing a pull-request for TextureHelper:254, but it will take some time until it’s accepted. Maybe @javasabr has a hint? Maybe he changed this in his custom jme fork?

Or does SS Editor add the HDR Loader somewhere?

I use jemalloc, it ignores JVM limits.

I didn’t change classes which relate to the blender loader in my fork.

Okay, PR’s #726 and #727 submitted.
The first one should prevent the import failing when a texture cannot load and the second one will support hdr files (if it’s okay that way, it might be faulty, discussion will follow).

For now there is not much you can do, removing the environment (the .hdr file) from blender maybe.
I still don’t understand why SS Editor did load that actually. Were you able to also import that background texture/environment?

1 Like

The background texture was not imported.

I see choosing a Blend from Blendswap started some issues here (just liked the Zeppelin).
In future I will try to remember the advices made about Blendswap models.