关于java的报错问题

代码在Eclipse上运行的好好的,在学校编译平台上编译也过了,可是出现这样的报错。

Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread

哪位大佬帮忙看一下

package test002;
import java.math.BigInteger;
import java.util.Scanner;

class My_BigIntegerMultiply {
	public static BigInteger My_MultiplyEn(BigInteger val1,BigInteger val2) {
		if(val1.signum()>0&&val2.signum()<0||val1.signum()<0&&val2.signum()>0) {
			return My_Multiply(val1.abs(),val2.abs()).multiply(new BigInteger("-1"));
		}else {
			return My_Multiply(val1.abs(),val2.abs());
		}
	}
	
	public static BigInteger My_Multiply(BigInteger val1,BigInteger val2) {
		BigInteger ZERO = new BigInteger("0",10);
		if(val1.signum()==0||val2.signum()==0) {
			return ZERO;
		}else if(val1.toString().length()<=80||val2.toString().length()<=80){
				return val1.multiply(val2);
		}else {
			return My_BigIntegerMultiply.My_MultiplyKaratsuba(val1,val2);
		}
	}
	
	public static BigInteger My_MultiplyKaratsuba(BigInteger val1,BigInteger val2) {
		int val1_len=val1.toString().length();
		int val2_len=val2.toString().length();
		int half = (val1_len>val2_len?val1_len:val2_len+1)/2;
		BigInteger val1_h = My_BigIntegerMultiply.getLower(val1, half);
		BigInteger val1_l = My_BigIntegerMultiply.getUpper(val1, half);
		BigInteger val2_h = My_BigIntegerMultiply.getLower(val2, half);
		BigInteger val2_l = My_BigIntegerMultiply.getUpper(val2, half);
		
		BigInteger a1 = My_BigIntegerMultiply.My_Multiply(val1_h, val2_h);
		BigInteger b1 = My_BigIntegerMultiply.My_Multiply(val1_l, val2_l);
		BigInteger c1 = My_BigIntegerMultiply.My_Multiply(val1_h.add(val1_l),val2_h.add(val2_l));
		
		BigInteger x1 = new BigInteger("10");
		BigInteger result = a1.multiply(x1.pow(half*2)).add(c1.subtract(a1).subtract(b1).multiply(x1.pow(half))).add(b1);
		
		return result;
	}
	
	public static BigInteger getUpper(BigInteger val,int half) {
		if(val.toString().length()<=half) {
			BigInteger b1 = new BigInteger("0");
			return b1;
		}
		BigInteger b1=new BigInteger(val.toString().substring(half,val.toString().length()));
		return b1;
	}
	public static BigInteger getLower(BigInteger val,int half) {
		if(val.toString().length()<=half) return val;
		BigInteger b1=new BigInteger(val.toString().substring(0,half));
		return b1;
	}
	
	public static void main(String ars[]) {
		Scanner sc = new Scanner(System.in);
		String st1 = sc.nextLine();
		String st2 = sc.nextLine();
		BigInteger B1 = new BigInteger(st1);
		BigInteger B2 = new BigInteger(st2);
		BigInteger R1 = My_BigIntegerMultiply.My_MultiplyEn(B1, B2);
		System.out.println(R1);
	}
}

 

可能内存不够了,放大虚拟机内存

内存溢出了,默认堆内存太少了,增加容器使用jvm得堆栈内存。

有一个测试用例是1259*8,结果也是像上面那样报错,堆内存不至于这么少吧