PikachuBLOG


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

JVM—GC 相关参数总结

发表于 2018-09-02 | 分类于 Java | 阅读次数
字数统计 656 | 阅读时长 2

1. 与串行回收器相关的参数

     -XX:+UseSerialGC :   在新生代和老年代使用串行回收器。

     -XX:+SuivivorRatio :   设置 eden 区大小和 survivor 区大小的比例。

      -XX:+PretenureSizeThreshold :   设置大对象直接进入老年代的阈值。当对象的大小超过这个值时,将直接在老年代分配。

      -XX:MaxTenuringThreshold :   设置对象进入老年代的年龄的最大值。每一次 Minor GC 后,对象年龄就加 1。任何大于这个年龄的对象,一定会进入老年代。

阅读全文 »

JVM—垃圾收集器

发表于 2018-09-02 | 分类于 Java | 阅读次数
字数统计 3,795 | 阅读时长 13

      如果说收集算法是内存回收的方法论,垃圾收集器就是内存回收的具体实现。Java虚拟机规范中对垃圾收集器应该如何实现并没有任何规定,因此不同的厂商、不同版本的虚拟机所提供的垃圾收集器都可能会有很大的差别,并且一般都会提供参数供用户根据自己的应用特点和要求组合出各个年代所使用的收集器。

                              image

      上图展示了7种作用于不同分代的收集器(包括JDK 1.7_Update14之后正式提供商用的G1收集器),如果两个收集器之间存在连线,就说明它们可以搭配使用。

      在介绍这些收集器各自的特性之前,我们先来明确一个观点:虽然我们是在对各个收集器进行比较,但并非为了挑选一个最好的收集器出来。因为直到现在为止还没有最好的收集器出现,更加没有万能的收集器,所以我们选择的只是对具体应用最合适的收集器。这点不需要多加解释就能证明:如果有一种放之四海皆准、任何场景下都适用的完美收集器存在,那HotSpot虚拟机就没必要实现那么多不同的收集器了。

阅读全文 »

JVM—垃圾收集算法

发表于 2018-09-02 | 分类于 Java | 阅读次数
字数统计 848 | 阅读时长 3

    1、标记-清除算法(Mark-Sweep)


      最基础的收集算法,之所以这么说,是因为下面的其它算法都是基于这种思路并对其不足进行改进而得到的。

      原理:分为标记-清除两个阶段

        1.标记阶段:首先标记出所有需要回收的对象。

        2.清除阶段:标记完成后,统一回收被标记的对象

阅读全文 »

JVM—对象存活判定算法

发表于 2018-09-02 | 分类于 Java | 阅读次数
字数统计 2,924 | 阅读时长 11

    1、引用计数算法


      引用计数算法就是对于创建的每一个对象都有一个与之关联的计数器,这个计数器记录着该对象被使用的次数,每当有一个地方引用它时,计数器值加1;当引用失效时,计数器减1;任何时刻计数器都为0的对象就是不可能再被使用的,垃圾收集器在进行垃圾回收时,对扫描到的每一个对象判断一下计数器是否等于0,若等于0,就会释放该对象占用的内存空间,同时将该对象引用的其他对象的计数器进行减一操作。

阅读全文 »

Hexo Blog

发表于 2018-09-02 | 分类于 Hexo | 阅读次数
字数统计 1,605 | 阅读时长 7

前言

  备忘通过Hexo实现从md文件生成静态页面,然后发布到GitHub Pages的过程。

主要流程

1、安装必须的软件

  1. 安装Git
    • Git官方版本的安装
  2. 安装Node.js
    • Node.js官方版本的安装
  3. 安装Hexo

    • 常规安装命令

      $ npm install -g hexo-cli

    • 常规命令有可能被“墙”,安装hexo为了避免出现类似情况,我使用淘宝NPM镜像,输入以下命令等待安装完成。

      $ npm install -g cnpm –registry=https://registry.npm.taobao.org

    • 使用淘宝NPM安装Hexo。

      $ cnpm install -g hexo-cli (与原先的npm完全一样,只是命令改为cnpm,一样等待hexo安装完成),出现的WARN可以不用理会,继续输入以下命令:
      $ cnpm install hexo –save

阅读全文 »

Work Begin

发表于 2018-04-07 | 分类于 C++ | 阅读次数
字数统计 24 | 阅读时长 1

Work Begin

Work hard and start recording your knowledge every day. Don’t forget to improve your professional knowledge in your work.

Need Work…

225. Implement Stack using Queues

发表于 2017-08-31 | 分类于 LeetCode | 阅读次数
字数统计 766 | 阅读时长 4

Implement the following operations of a stack using queues.

push(x) –Push element x onto stack.
pop() –Removes the element on top of the stack.
top() –Get the top element.
empty() –Return whether the stack is empty.

Notes:
You must use only standard operations of a queue – which means only push to back, peek / pop from front, size, and is empty operations are valid.
Depending on your language, queue may not be supported natively.You may simulate a queue by using a list or deque(double - ended queue), as long as you use only standard operations of a queue.
You may assume that all operations are valid(for example, no pop or top operations will be called on an empty stack).

阅读全文 »

224. Basic Calculator

发表于 2017-08-31 | 分类于 LeetCode | 阅读次数
字数统计 1,080 | 阅读时长 6

Implement a basic calculator to evaluate a simple expression string.
he expression string may contain open(and closing parentheses), the plus + or minus sign - , non - negative integers and empty spaces .

You may assume that the given expression is always valid.
Some examples :
“1 + 1” = 2
“ 2-1 + 2 “ = 3
“(1+(4+5+2)-3)+(6+8)” = 23

阅读全文 »

222. Count Complete Tree Nodes

发表于 2017-08-31 | 分类于 LeetCode | 阅读次数
字数统计 699 | 阅读时长 3

Given a complete binary tree, count the number of nodes.

题意:

  给定一棵完全二叉树,求树种节点的个数。

阅读全文 »

219. Contains Duplicate II

发表于 2017-08-30 | 分类于 LeetCode | 阅读次数
字数统计 399 | 阅读时长 2

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array
such that nums[i] = nums[j] and the difference between i and j is at most k.

阅读全文 »
123…17
CodePikachu

CodePikachu

技术随笔

168 日志
5 分类
7 标签
RSS
GitHub Twitter 微博 知乎
0%
© 2015 - 2020 CodePikachu
博客全站共123.3k字
本站访客数:
由 Hexo 强力驱动
主题 - NexT.Pisces