java.创建一个byte数组,long length = file.length(); byte[] bytes = new byte[(int)length]; 结果导致问题错误为:java.lang.OutOfMemoryError:Java heap space\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.getBytesFromFile(MONServiceImpl

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 22:50:47

java.创建一个byte数组,long length = file.length(); byte[] bytes = new byte[(int)length]; 结果导致问题错误为:java.lang.OutOfMemoryError:Java heap space\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.getBytesFromFile(MONServiceImpl
java.创建一个byte数组,long length = file.length(); byte[] bytes = new byte[(int)length]; 结果导致
问题错误为:java.lang.OutOfMemoryError:Java heap space
\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.getBytesFromFile(MONServiceImpl.java:76)
\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.spliteBytes(MONServiceImpl.java:97)
\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.getFileLine(MONServiceImpl.java:59)
\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.upload(MONServiceImpl.java:45)
\x05at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
\x05at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
\x05at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
\x05at java.lang.reflect.Method.invoke(Method.java:597)
\x05at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
\x05at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
\x05at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
\x05at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
\x05at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
\x05at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
\x05at $Proxy6.upload(Unknown Source)
\x05at com.hitrust.FCBCNB.test.MonTest.testA(MonTest.java:30)
\x05at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
\x05at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
\x05at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
\x05at java.lang.reflect.Method.invoke(Method.java:597)
\x05at junit.framework.TestCase.runTest(TestCase.java:154)
\x05at junit.framework.TestCase.runBare(TestCase.java:127)
\x05at junit.framework.TestResult$1.protect(TestResult.java:106)
\x05at junit.framework.TestResult.runProtected(TestResult.java:124)
\x05at junit.framework.TestResult.run(TestResult.java:109)
\x05at junit.framework.TestCase.run(TestCase.java:118)
\x05at junit.framework.TestSuite.runTest(TestSuite.java:208)
\x05at junit.framework.TestSuite.run(TestSuite.java:203)
\x05at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
\x05at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
\x05at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
\x05at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
请问该如何解决,这里的length大小为150994943.

java.创建一个byte数组,long length = file.length(); byte[] bytes = new byte[(int)length]; 结果导致问题错误为:java.lang.OutOfMemoryError:Java heap space\x05at com.hitrust.FCBCNB.service.impl.MONServiceImpl.getBytesFromFile(MONServiceImpl
好恐怖的长度