Differences between Heap Dump, thread dump and core dump (#14718)
* Differences between Heap Dump, thread dump and core dump * Differences between Heap Dump, thread dump and core dump * Differences between Heap Dump, thread dump and core dump * Differences Between Heap Dump, Thread Dump and Core Dump
This commit is contained in:
parent
7c02a6ffdb
commit
cc911cefeb
@ -0,0 +1,15 @@
|
|||||||
|
#include <jni.h>
|
||||||
|
#include "CoreDump.h"
|
||||||
|
|
||||||
|
void core() {
|
||||||
|
int *p = NULL;
|
||||||
|
*p = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_CoreDump_core (JNIEnv *env, jobject obj) {
|
||||||
|
core();
|
||||||
|
};
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||||
|
#include <jni.h>
|
||||||
|
/* Header for class CoreDump */
|
||||||
|
|
||||||
|
#ifndef _Included_CoreDump
|
||||||
|
#define _Included_CoreDump
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Class: CoreDump
|
||||||
|
* Method: core
|
||||||
|
* Signature: ()V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_CoreDump_core
|
||||||
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.baeldung.dumps;
|
||||||
|
|
||||||
|
public class CoreDump {
|
||||||
|
static {
|
||||||
|
System.loadLibrary("nativelib");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new CoreDump().core();
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void core();
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.baeldung.dumps;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HeapDump {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
List<Integer> numbers = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
while (true) {
|
||||||
|
numbers.add(10);
|
||||||
|
}
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
System.out.println("Out of memory error occurred!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.baeldung.dumps;
|
||||||
|
|
||||||
|
public class ThreadDump {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
longRunningTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void longRunningTask() {
|
||||||
|
for (int i = 0; i < Integer.MAX_VALUE; i++) {
|
||||||
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
|
System.out.println("Interrupted!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user