- 浏览: 541165 次
- 性别:
- 来自: 杭州
-
最新评论
-
飞天奔月:
public List<String> gener ...
实践中的重构30_不做油漆匠 -
在世界的中心呼喚愛:
在世界的中心呼喚愛 写道public class A {
...
深入理解ReferenceQueue GC finalize Reference -
在世界的中心呼喚愛:
在世界的中心呼喚愛 写道在世界的中心呼喚愛 写道在classB ...
深入理解ReferenceQueue GC finalize Reference -
在世界的中心呼喚愛:
在世界的中心呼喚愛 写道在classB的finalize上打断 ...
深入理解ReferenceQueue GC finalize Reference -
在世界的中心呼喚愛:
iteye比较少上,如果可以的话,可以发e-mail交流:ch ...
深入理解ReferenceQueue GC finalize Reference
文章列表
package leetcode;
/**
* <pre>
* Given two sorted integer arrays A and B, merge B into A as one sorted array.
*
* Note:
* You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from B. The number of elements initialized in A and B are m ...
/**
* <pre>
* Given a binary tree, find its maximum depth.
*
* The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
* </pre>
* */
public class MaximumDepthofBinaryTree {
public class TreeNode {
int val;
...
/**
*
* <pre>
* Follow up for "Find Minimum in Rotated Sorted Array":
* What if duplicates are allowed?
*
* Would this affect the run-time complexity? How and why?
* Suppose a sorted array is rotated at some pivot unknown to you beforehand.
*
* (i.e., 0 1 2 4 5 6 7 might b ...
package leetcode;
/**
* <pre>
* Say you have an array for which the ith element is the price of a given stock on day i.
*
* If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
* < ...
package leetcode;
/**
* <pre>
* Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
*
* An example is the root-to-leaf path 1->2->3 which represents the number 123.
*
* Find the total sum of all root-to-leaf numbers.
*
* For ex ...
package leetcode;
/**
* <pre>
* Given a linked list, determine if it has a cycle in it.
*
* Follow up:
* Can you solve it without using extra space?
* </pre>
* */
public class LinkedListCycle {
class ListNode {
int val;
ListNode next;
ListNode(i ...
package leetcode;
/**
* Find Minimum in Rotated Sorted Array
*
* <pre>
* Suppose a sorted array is rotated at some pivot unknown to you
* beforehand.
*
* (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
*
* Find the minimum element.
*
* You may assume no duplicate exists in the ...
/**
* <pre>
* You are climbing a stair case. It takes n steps to reach to the top.
*
* Each time you can either climb 1 or 2 steps.
* In how many distinct ways can you climb to the top?
* </pre>
*/
public class ClimbingStairs {
//Time Limit Exceeded
public class Solution ...
package leetcode;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* <pre>
* Given a binary tree, return the preorder traversal of its nodes' values.
*
* For example:
* Given binary tree {1,#,2,3},
* 1
* \
* 2
* /
* 3
* return [1,2,3].
* &l ...
/**
*
* <pre>
* You are given two linked lists representing two non-negative numbers.
* The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
*
* Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
* Out ...
MemoryUtil
关于java对象内存的基本知识,请参考
http://zhang-xzhi-xjtu.iteye.com/blog/2116304
源代码
https://github.com/zhang-xzhi/memoryutil
以下功能对于32bits JVM,64bits JVM开启压缩指针,64bits JVM关闭压缩指针都适用。
MemoryUtil
可以获得对象的shallowsize。
可以获得对象的fullsize。
可以获得对象的padding size。
可以获得对象的full padding size。
MemoryDetailEntry的toStri ...
引言
Java的对象被jvm管理,单个对象如何布局,大小如何,程序员可以不用关心。
但是,掌握一些相关的知识,可以让我们对应用中使用的对象大小有一个大致的估计,做到心中有数,当遇到内存敏感型应用时,可以通过适当的参数调节和应用优化减少内存占用。
另外,just for fun。
声明
以下讨论大部分都是基于32bits Java Hotspot VM,关于64bits的会特殊声明。
本文查看java对象的内存输出来自工具包memoryutil
http://zhang-xzhi-xjtu.iteye.com/admin/blogs/2116347
Java对象内存组成
对象内存由以下几部 ...
可以查看java对象的MemoryUtil简介
- 博客分类:
- 程序共享
MemoryUtil
关于java对象内存的基本知识,请参考
http://zhang-xzhi-xjtu.iteye.com/blog/2116304
源代码
https://github.com/zhang-xzhi/memoryutil
以下功能对于32bits JVM,64bits JVM开启压缩指针,64bits JVM关闭压缩指针都适用。
MemoryUtil
可以获得对象的shallowsize。
可以获得对象的fullsize。
可以获得对象的padding size。
可以获得对象的full padding size。
MemoryDetailEntry的toStri ...
GCviewer
https://github.com/zhang-xzhi/gcviewer
Java gc日志的一个GUI解析器。
目前只能解析CMS GC日志。
界面如下:
目前主要可以通过GUI展现以下3类信息
1 事件个数。
2 内存大小。
3 gc消耗时间。
详细的介绍请参考附件pdf。
GCviewer
https://github.com/zhang-xzhi/gcviewer
Java gc日志的一个GUI解析器。
目前只能解析CMS GC日志。
界面如下:
目前主要可以通过GUI展现以下3类信息
1 事件个数。
2 内存大小。
3 gc消耗时间。
详细的介绍请参考附件pdf。