我一直试图找到答案,但我仍然不能.
我有一台64位机器,256 GB RAM.
我正在尝试执行链接到MySQL的Java程序.它需要一个安静的大堆大小,因为当我-Xmx1024m在几分钟后使用VM参数时会弹出:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试将程序VM参数设置为-Xmx2048m或更大时,它不起作用并说:
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Run Code Online (Sandbox Code Playgroud)
我读到-Xmx204864位机器的设置不是问题,但我真的不知道为什么它不能在我的机器上工作.
java -version 输出:

wmic OS获取FreePhysicalMemory/Value输出:
FreePhysicalMemory=251663664
Run Code Online (Sandbox Code Playgroud)
wmic computersystem获取TotalPhysicalMemory输出:
TotalPhysicalMemory
274811621376
Run Code Online (Sandbox Code Playgroud)
wmic os得到osarchitecture输出
OSArchitecture
64-bit
Run Code Online (Sandbox Code Playgroud)
我无法执行,systeminfo|find "Memory"因为它说错了语法.我也不确定为什么.
我有一个citations包含 500 万行的表,其中包含以下信息:
Paperkey1 | Year1 | Paperkey2 | Year2
100 20
200 90
300 80
Run Code Online (Sandbox Code Playgroud)
另一张表pub_year约有 300 万行,其中包含以下信息:
Paperkey | Year
100 2001
200 2002
20 2003
90 2004
80 2005
Run Code Online (Sandbox Code Playgroud)
citations我想通过从 table 中获取年份值来更新表pub_year。我使用了以下查询,但它已经运行了 3 个多小时,但仍未完成。
update citations T2
join pub_year T1 on T2.paperkey1= T1.paperkey
set T2.year1 = T1.year;
Run Code Online (Sandbox Code Playgroud)
有谁知道它花费太长时间的主要原因是什么?我不确定如果我继续让它运行它是否会完成。或者我的查询有问题吗?paperkey 字段全部为 varchar,year 字段全部为整数。谢谢。
这是运行 EXPLAIN 后的更新:

我知道在stackoverflow中已经有很多问题,但我找不到能解决问题的答案.
在下面的代码中,我不能打印出每个项目,ArrayList<Integer>因为它说明了"Edge cannot be cast to java.lang.Integer".
我试图使用for(Integer item :p1)和打印每个项目,for (int item: p1)但两个都没有工作.
我想也许问题是因为toString()Edge类中的方法但是如果我不使用toString()我不能得到真正的密钥号(它将被打印为Edge@28a418fc或类似的东西)
谢谢你以前的帮助
主要课程
public class Ranker7 {
static Graph g;
static Node n;
static Edge e;
static HashMap<Integer, Node> nodeMap;
int id;
static double weight;
static int year;
static int type;
Ranker7() {
g = new Graph();
nodeMap = new HashMap<Integer, Node>();
n = new Node(id,year,type,weight);
}
public static void main (String[] args) …Run Code Online (Sandbox Code Playgroud)