B
B
blacksmith7712014-05-15 16:38:50
Java
blacksmith771, 2014-05-15 16:38:50

How to simulate a heap overflow in Java?

How to simulate a heap overflow in Java?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Vershinin, 2014-05-15
@blacksmith771

String[] arr = new String[Integer.MAX_VALUE];
String t = "aaaaa", b = "bbbbb";

for(int i = 0; i < Integer.MAX_VALUE; i++) {
     arr[i] = t;
     t += b;
}

B
blacksmith771, 2014-05-15
@blacksmith771

Thanks a lot)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question