DirectMemory容量可通过-XX:MaxDirectMemorySize指定,如果不指定,则默认与Java堆的最大值(-Xmx指定)一样。代码中越过了DirectByteBuffer类,直接通过反射获取Unsafe实例并进行内存分配(Unsafe类的getUnsafe()方法限制了只有引导类加载器才会返回实例,也就是设计者希望只有r..
分类:
其他好文 时间:
2014-07-28 16:43:04
阅读次数:
281
当Java处理的数据量比较大时常常会出现:java.lang.OutOfMemoryError: Java heap space意味着JVM的堆内存耗尽了。如果有需要的话,可以通过设置JVM的参数来调整Heap的大小。 这中间有几个参数:参数名称含义默认值-Xms初始堆大小物理内存的1/64(...
分类:
编程语言 时间:
2014-07-28 15:22:43
阅读次数:
257
题目: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 e....
分类:
编程语言 时间:
2014-07-28 14:47:23
阅读次数:
1108
题目:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last w....
分类:
编程语言 时间:
2014-07-28 11:35:00
阅读次数:
250
原题http://acm.timus.ru/problem.aspx?space=1&num=1804
D - The Machinegunners in a Playoff
Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d
& %I64u
Submit Status
Desc...
分类:
其他好文 时间:
2014-07-28 00:29:30
阅读次数:
242
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. Y...
分类:
其他好文 时间:
2014-07-28 00:28:19
阅读次数:
273
Deferred lighting separate lighting rendering and make lighting a completely image-space technique. This is very different the forward rendering. At f...
分类:
其他好文 时间:
2014-07-27 21:43:45
阅读次数:
1430
题目:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space....
分类:
编程语言 时间:
2014-07-27 21:26:35
阅读次数:
267
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space...
分类:
其他好文 时间:
2014-07-26 14:29:30
阅读次数:
183
题目:Sort a linked list in O(n log n) time using constant space complexity.题解:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sor....
分类:
编程语言 时间:
2014-07-26 09:51:57
阅读次数:
307