I must be going crazy … hopefully I am. I have some basic test code that takes in a spatial , exports it to a byte array and saved it to the database. I took the blob data from the database and saved it to a .j3o file and tried to load it into the sdk and looks like the SDK ran in an infinite loop until it ran out of heap.
The Code:
public static void saveSpatial(Spatial spatial, long runtimeUserId, String path, AssetManager assetManager)
{
JmeExporter ex = BinaryExporter.getInstance();
ByteArrayOutputStream out = new ByteArrayOutputStream();
try
{
ex.save(spatial, out);
setServerData(ASSET_KEY, path, out.toByteArray(), runtimeUserId);
System.err.println(out.toByteArray());
out.close();
assetManager.deleteFromCache(createModelKey(runtimeUserId, path));
} catch (IOException e)
{
e.printStackTrace();
}
}
The exception after the SDK tries to load the binary into scene composer:
java.lang.OutOfMemoryError: Java heap space
at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:149)
at java.lang.StringCoding.decode(StringCoding.java:193)
at java.lang.StringCoding.decode(StringCoding.java:254)
at java.lang.String.<init>(String.java:546)
at java.lang.String.<init>(String.java:566)
at com.jme3.export.binary.BinaryImporter.readString(BinaryImporter.java:295)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:181)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:125)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:109)
at com.jme3.export.binary.BinaryLoader.load(BinaryLoader.java:36)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
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.scenecomposer.OpenSceneComposer$1.run(OpenSceneComposer.java:37)
at java.lang.Thread.run(Thread.java:748)