这样一个数据结构:public class Feature
{
String name = new String();
byte[] coords = new byte[128]; // 所有维度的数值
}
读入的时候是这样读取的:int k;
int total = 10000000;
while ((tempString = reader.readLine()) != null && i!=total-1)
{
String[] vector = tempString.split(" ");
f[i] = new Feature();
f[i].name = vector[0];
for(int j=0;j<128;j++)
{
k = Integer.valueOf(vector[j+1]);
f[i].coords[j] = (byte)k;
}
i++;
vector = null;
}特地把虚拟机开到了7G内存,但是在读入到600w左右的数据之后就已经超内存了然后运行暴慢!!!
按道理来讲这样一个类开到1000w内存也不应该超过2G啊。。
求问大家这是什么原因呢?><
{
String name = new String();
byte[] coords = new byte[128]; // 所有维度的数值
}
读入的时候是这样读取的:int k;
int total = 10000000;
while ((tempString = reader.readLine()) != null && i!=total-1)
{
String[] vector = tempString.split(" ");
f[i] = new Feature();
f[i].name = vector[0];
for(int j=0;j<128;j++)
{
k = Integer.valueOf(vector[j+1]);
f[i].coords[j] = (byte)k;
}
i++;
vector = null;
}特地把虚拟机开到了7G内存,但是在读入到600w左右的数据之后就已经超内存了然后运行暴慢!!!
按道理来讲这样一个类开到1000w内存也不应该超过2G啊。。
求问大家这是什么原因呢?><
String s="abcd efgh hijk";
String[] ss=s.split(" ");
Field f=String.class.getDeclaredField("value");
f.setAccessible(true);
System.out.println(f.get(s)==f.get(ss[0]));
}