假定执行环境不同。
eclipse.ini文件的内容。
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
C:\Users\GIT\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM
-vmargs
-javaagent:lombok.jar
这是Window CMD中的执行环境。
java -jar -Xms1024m -Xmx1024m [jar file]
我的例外是
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Direct buffer memory
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.git.gdsbuilder.validator.collection.CollectionValidator.geometricValidate(CollectionValidator.java:1743)
at com.git.gdsbuilder.validator.collection.CollectionValidator.collectionValidate(CollectionValidator.java:192)
at com.git.gdsbuilder.validator.collection.CollectionValidator.<init>(CollectionValidator.java:118)
at com.git.batch.service.BathService$1.run(BathService.java:451)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Caused by: 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.geotools.resources.NIOUtilities.allocate(NIOUtilities.java:152)
at org.geotools.data.shapefile.shp.ShapefileReader.ensureCapacity(ShapefileReader.java:302)
at org.geotools.data.shapefile.shp.ShapefileReader.nextRecord(ShapefileReader.java:561)
at org.geotools.data.shapefile.ShapefileFeatureReader.hasNext(ShapefileFeatureReader.java:180)
at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.hasNext(ContentFeatureCollection.java:143)
at com.git.gdsbuilder.validator.feature.FeatureGraphicValidatorImpl.validateOneAcre(FeatureGraphicValidatorImpl.java:1500)
at com.git.gdsbuilder.validator.layer.LayerValidatorImpl.validateOneAcre(LayerValidatorImpl.java:1100)
at com.git.gdsbuilder.validator.collection.CollectionValidator$3Task.run(CollectionValidator.java:1702)
... 5 more
潜在的问题是内存泄漏,但是一旦我想使执行环境相同。
我该怎么办?