forked from s-u/rJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeaks.java
More file actions
41 lines (33 loc) · 900 Bytes
/
Leaks.java
File metadata and controls
41 lines (33 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class Leaks {
public int[] i;
public String[] s;
public Leaks(int[] i, String[] s) {
this.i = i;
this.s = s;
}
public String[] getS() { return s; }
public int[] getI() { return i; }
public String[] replaceS(String[] s) {
String[] a = this.s;
this.s = s;
return a;
}
public int[] replaceI(int[] i) {
int[] a = this.i;
this.i = i;
return a;
}
public static String[] passS(String[] s) { return s; }
public static Object[] passSO(String[] s) { return (Object[])s; }
public static int[] passI(int[] i) { return i; }
public static void runGC() {
Runtime r = Runtime.getRuntime();
r.runFinalization();
r.gc();
}
public static String reportMem() {
Runtime r = Runtime.getRuntime();
r.gc();
return "used: "+((r.totalMemory()-r.freeMemory())/1024L)+"kB (free: "+r.freeMemory()+" of "+r.totalMemory()+")";
}
}