Common memory overflow exceptions for jvm
The figure above is the main data area of the jvm virtual machine when it runs. The blue part is the thread sharing area, and the white part is the thread private area.
The following examples all run in jdk1.7
1. Heap memory overflow
/**
* VM Args: -Xms2m -Xmx2m
* Created by Stay on 2017/5/15 14:50.
*/
public class Base1 {
...
Posted by smc on Sun, 30 Jun 2019 10:18:42 -0700
kotlin + List Drag, Resort, Slide and Delete
kotlinTouchHelperDemo
Github address to all guest officers: https://github.com/Niekon/kotlinTouchHelperDemo
Brief Book Address: http://www.jianshu.com/p/2e591df06d73
I wanted to write kotlin's Demo a month ago and learn it before kotlin became Android's mainstream development language.
But there has been no time in the middle, just these ...
Posted by DesertFox07 on Fri, 28 Jun 2019 15:50:17 -0700
static Keyword Explanation
Reprint address: http://www.cnblogs.com/heimianshusheng/p/5828844.html
Speaking of the static keyword, I believe that you will never be strange, but, want to fully explain, fierce thinking, find that they do not seem to understand... For example, when I was asked by a classmate yesterday... Of course, not everyone is as poor as I am, but t ...
Posted by NeoSsjin on Thu, 27 Jun 2019 14:22:14 -0700
New features of Java 5, Java 6, Java 7, Java 8
Java5:
Generics:After referencing generics, it allows you to specify the type of elements in a collection, eliminates mandatory type conversion, and has the advantage of type checking at compile time.
As parameters and return values, Generic is the cornerstone of vararg, annotation, enumeration, collection.
A. Type Safety
When y ...
Posted by [PQ3]RogeR on Wed, 26 Jun 2019 10:41:14 -0700
Is it generic in your eyes?
Following the book?extends T and?After Sup T, let's talk about generics.
Demo 1
public interface Generator {
<T> T next();
}
The first solution is to add'<T>'before the method return type to make it a generic method.
public interface Generator<T> {
T next();
}
The second solution is to add'<T>'to the interface ...
Posted by ramrod737 on Sat, 15 Jun 2019 10:18:30 -0700
Thread Interrupt for Marble Principle
This chapter relies on Marble Use, so make sure you have a good understanding of Marble before reading it.
The interrupt feature is supported starting with Marble-Agent 2.0.5.
Thread interrupt use
Introducing the marble-agent jar package
xml
<dependency>
<groupId>com.github.jeff-dong</groupId>
<artifactId ...
Posted by Ellen67 on Fri, 14 Jun 2019 13:23:19 -0700
Wouldn't there be OOM using Metaspace in Java 8?
Foreword: In Java 8, the emergence of Metaspace prevents us from encountering the problem of java.lang.OutOfMemoryError: PermGen, but we should remember that this new feature will not eliminate the memory leak caused by class loading.
(1) A brief introduction to Metaspace
(1) Memory model: Most class metadata are allocated in local memory, a ...
Posted by ow-phil on Thu, 13 Jun 2019 16:30:21 -0700
Deep Understanding of Java Virtual Machines (IV)
Detailed Description of Virtual Machine Performance Monitoring and Fault Handling Tools
4.1 Overview
This article refers to Chapter IV of Zhou Zhiming's "Deep Understanding of Java Virtual Machine", in order to sort out ideas, simply record it for later reference.
JDK itself provides a lot of convenient monitoring tools for JVM perfor ...
Posted by jwagner on Sat, 08 Jun 2019 16:28:06 -0700
Beauty of Concurrent Programming - Analysis of Notification and Waiting Principles (wait, notify, notifyAll)
The producer-consumer model is a classic case for us to learn multithreaded knowledge. A typical producer-consumer model is as follows:
public void produce() {
synchronized (this) {
while (mBuf.isFull()) {
try {
wait();
} catch (InterruptedException e) {
...
Posted by alan543 on Mon, 03 Jun 2019 18:55:09 -0700
Several Solutions to the Continuous Printing abc of java Multithread Programming Problem
A programming problem is as follows:
Instantiate three threads, one thread prints a, one prints b, one prints c, three threads execute at the same time, and require six connected ABCs to be printed.
Topic analysis:
From the meaning of the question, we can conclude that we need to use three threads, three threads will print six characters, the k ...
Posted by renob on Mon, 27 May 2019 13:08:14 -0700