This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
import sun.misc.Unsafe; | |
public class TestThreadStackSize { | |
private static void crashVM() { | |
try { | |
makeSegfault(getUnsafe()); | |
} catch (Exception e) { | |
// swallow | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.*; | |
import java.util.*; | |
public class DirectMemoryCrashDemo { | |
private static int BUFFER_COUNT = 82; | |
private static int K = 1024; | |
private static int M = K * K; | |
private static int PAGE_SIZE = 4*K; | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DO NOT EDIT THIS FILE - it is machine generated */ | |
#include <jni.h> | |
/* Header for class StackOverflowCrashDemo */ | |
#ifndef _Included_StackOverflowCrashDemo | |
#define _Included_StackOverflowCrashDemo | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
Test test = new Test(); | |
test.fn(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DO NOT EDIT THIS FILE - it is machine generated */ | |
#include <jni.h> | |
/* Header for class JNILocalRefLeakDemo */ | |
#ifndef _Included_JNILocalRefLeakDemo | |
#define _Included_JNILocalRefLeakDemo | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pseudo-code that implements Cheney's algorithm | |
class Object { | |
// remains null for normal objects | |
// non-null for forwarded objects | |
Object* _forwardee; | |
public: | |
void forward_to(address new_addr); | |
Object* forwardee(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rednaxelafx@fx-laptop:/tmp | |
$ gedit xx.cpp | |
rednaxelafx@fx-laptop:/tmp | |
$ g++ -g xx.cpp | |
rednaxelafx@fx-laptop:/tmp | |
$ g++ -v | |
Using built-in specs. | |
Target: x86_64-linux-gnu | |
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5.1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu | |
Thread model: posix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ top -H | |
... | |
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND | |
19115 root 25 0 576m 217m 9432 R 99.7 5.3 1357:12 java | |
28347 root 25 0 576m 217m 9432 R 99.7 5.3 1191:05 java | |
26912 root 25 0 576m 217m 9432 R 99.3 5.3 114:58.57 java | |
5607 root 25 0 576m 217m 9432 R 99.0 5.3 54:49.02 java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.instrument.Instrumentation; | |
import java.net.URL; | |
import java.security.CodeSource; | |
import java.security.ProtectionDomain; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
public class DumpClassURL { | |
public static void agentmain(String agentArgs, Instrumentation inst) { | |
Class<?>[] classes = inst.getAllLoadedClasses(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fx.jvm.hotspot.tools; | |
import java.util.List; | |
import sun.jvm.hotspot.tools.Tool; | |
public class PrintThreadIds extends Tool { | |
public static void main(String[] args) { | |
PrintThreadIds tool = new PrintThreadIds(); | |
tool.start(args); |