JAVA 大数据内存耗用测试
2016-01-09 16:32
429 查看
JAVA 大数据内存耗用测试
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
public class MemoryTest {
public static void main(String[] args) throws InterruptedException {
int row = 50_000;
int column = 20;
String[] data = new String[row * column];
for (int i = 0; i < data.length; i++) {
data[i] = "columnName" + (i % column);
}
while (true) {
int i = (int) (Math.random() % (row * column));
if (data[i] == data[(i + column) % (row * column)]) {
System.out.println("the seme object");
}
System.gc();
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
long used = memoryMXBean.getHeapMemoryUsage().getUsed();
System.out.println("used:" + used / 1024d /1024d);
Thread.sleep(10_000);
}
}
}
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
public class MemoryTest {
public static void main(String[] args) throws InterruptedException {
int row = 50_000;
int column = 20;
String[] data = new String[row * column];
for (int i = 0; i < data.length; i++) {
data[i] = "columnName" + (i % column);
}
while (true) {
int i = (int) (Math.random() % (row * column));
if (data[i] == data[(i + column) % (row * column)]) {
System.out.println("the seme object");
}
System.gc();
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
long used = memoryMXBean.getHeapMemoryUsage().getUsed();
System.out.println("used:" + used / 1024d /1024d);
Thread.sleep(10_000);
}
}
}
相关文章推荐
- Contains Duplicate II leetcode
- 【转载】Kafka High Availability
- Contains Duplicate leetcode
- Codeforces Round #180 (Div. 2) B. Sail 贪心
- 职责链模式(Chain of Responsibility)
- offsetof与container_of宏[总结]
- 大数据系列第七课:RDD于Spark运行机制
- Codeforces Round #338 (Div. 2) B. Longtail Hedgehog
- Codef b125 orces 615B Longtail Hedgehog 【dp】
- UVa 474 - Heads / Tails Probability
- mailx定时任务不能执行
- B. Longtail Hedgehog【记忆化搜索】
- Hadoop和大数据:60款顶级大数据开源工具
- 大数据分析技术生态圈一览
- [CodeForces 615B]Longtail Hedgehog[DP]
- Binder与Service 通信机制详解四 (源码分析AIDL工作机制)
- 大数据性能调优之HBase的RowKey设计
- Codeforces Round #338 (Div. 2)B. Longtail Hedgehog(贪心+dp)
- hadoop hdfs fsimage和eidts
- 2016年大数据发展趋势(BigData Trends 2016)