不幸的是,看起来这个最近封闭的问题还不太清楚.这是典型的输出:
run:
Trying to Remove JDialog
Remove Cycle Done :-)
Checking if still exists any of TopLayoutContainers
JFrame
JDialog
Will Try Remove Dialog again, CycleNo. 1
-----------------------------------------------------------
Trying to Remove JDialog
Remove Cycle Done :-)
Checking if still exists any of TopLayoutContainers
JFrame
JDialog
Will Try Remove Dialog again, CycleNo. 2
-----------------------------------------------------------
Trying to Remove JDialog
Remove Cycle Done :-)
Checking if still exists any of TopLayoutContainers
JFrame
JDialog
Will Try Remove Dialog again, CycleNo. 3
-----------------------------------------------------------
Trying …Run Code Online (Sandbox Code Playgroud) 我正在研究处理大量非常密集流量的Java服务器.服务器接受来自客户端的数据包(通常是几兆字节)并将它们转发给其他客户端.服务器从不显式存储任何传入/传出数据包.然而,服务器不断遇到OutOfMemoryException异常.
我添加System.gc()到服务器的消息传递组件中,希望释放内存.另外,我将JVM的堆大小设置为千兆字节.我仍然得到了许多例外.
所以我的问题是:如何确保兆字节消息无限期排队(尽管不需要)?有没有办法让我在这些对象上调用"delete"来保证它们不使用我的堆空间?
try
{
while (true)
{
int r = generator.nextInt(100);//generate a random number between 0 and 100
Object o =readFromServer.readObject();
sum++;
// if the random number is larger than the drop rate, send the object to client, else
//it will be dropped
if (r > dropRate)
{
writeToClient.writeObject(o);
writeToClient.flush();
numOfSend++;
System.out.printf("No. %d send\n",sum);
}//if
}//while
}//try
Run Code Online (Sandbox Code Playgroud) 来自JVM崩溃的日志文件包含用于调试的各种有用信息,例如加载的共享库和完整的环境.我可以强制JVM以编程方式生成其中一个; 要么通过执行崩溃它的代码或其他方式?或者以另一种方式访问相同的信息?