@Override publicvoid run() { new Main().stressArray(mDoLog);
}
}
Object [] array = new Object[8000];
void allocateFourStrings() { for (int i = 0; i < 4; i++) {
String str = new String("Creating some garbage" + Math.random()); if (str.length() < 22) {
System.out.println("bad length");
}
}
}
void stressArray(boolean doLog) { // We want many references in the array // We also want elements close to each other to have large // diff in address so lets skip every 2:nd address so it is null if (doLog) {
System.out.println("Initializing...");
} for (int i = 0; i < array.length; i+=2) {
array[i] = new String("Creating some garbage" + i);
}
if (doLog) {
System.out.println("Starting the test");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.