??xml version="1.0" encoding="utf-8" standalone="yes"?> //testMap.htm
I am getting Out of Memory errors, how can I allocate more memory to FishEye?
Since the default memory setting usually is around 64MB or 128MB, you might have to adjust the settings to run a bigger FishEye instance with sufficient memory.
There are a number of different memory errors that the JVM will throw. The most common are listed as follows. After having set the FISHEYE_OPTS and restarting your server, go to Administration > Sys Info/Support > System Info, and check your JVM Input Arguments to ensure that your server is picking up your FISHEYE_OPTS as expected. To solve this error, you will need to add the argument -Xmx1024m to FISHEYE_OPTS, in addition to any argument you use to set the heap size. Often you need to increase the amount of memory allocated to fisheye during the initial scan and period and once this is completed you can reduce back down. FISHEYE_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m" After having set the FISHEYE_OPTS and restarting your server, go to Administration > Sys Info/Support > System Info, and check your JVM Input Arguments to ensure that your server is picking up your FISHEYE_OPTS as expected.
If you get the error message: java.lang.OutOfMemoryError: PermGen space this means that you have exceeded Java's fixed 64MB block for loading class files. You will need to add the argument -XX:MaxPermSize=256m to FISHEYE_OPTS, in addition to any argument you use to set the heap size. FISHEYE_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m" After having set the FISHEYE_OPTS and restarting your server, go to Administration > Sys Info/Support > System Info, and check your JVM Input Arguments to ensure that your server is picking up your FISHEYE_OPTS as expected. This error occurs when the operating system is unable to create new threads. This is due to the JVM Heap taking up the available RAM.
Big heaps take away from the space that can be allocated for the stack of a new thread
To fix this problem, you should reduce the size of your JVM Heap and also the size of the stack per thread. FISHEYE_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m -Xss512k" Please refer to this guide as a reference for JVM tuning. After having set the FISHEYE_OPTS and restarting your server, go to Administration > Sys Info/Support > System Info, and check your JVM Input Arguments to ensure that your server is picking up your FISHEYE_OPTS as expected. This error indicates that the JVM took too long to free up memory during its GC process. This error can be thrown from the Parallel or Concurrent collectors. The parallel collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line. To overcome this issue, you need to make sure that all processes can't allocate more memory than there is system memory. In practice this is impossible to do for all processes. At a minimum you should make sure that all your jvm's do not have a total maximum memory allocation than your normally available system memory. Please refer to this guide for more information. Essentially the native objects does not have enough memory to use. This is usually because you have allocated too much memory to your heap reducing the amount available for native objects. See this article. The solution is to reduce the amount of heap memory you have allocated. For example if you have set -Xmx4096, you should consider reducing this to -Xmx2048m. Remember if you are using a 32bit JVM you cannot allocate more than -Xmx2048m for linux (and even less for windows). Using a 64 bit JVM can resolve this problem, but is not recommended for fisheye/crucible instances (refer to System Requirements). I used to be able to open *.sql files in my Eclipse text editor. For some reason that stopped working this morning: Invalid menu handle. Problems opening an editor... unable to open external editor. To fix this behavior for ALL files of a certain extension: Window > Preferences - ... and on the Preferences Tree: General > Editors > File Associations - ... add your File Type extension, for example *.sql ... and finally add your Associated Editor. I chose "internal editors" - "text editor" You can also change the behavior "temporarily" for a single file. Right click the file, click "Open With..." and select the editor...
Array.prototype.remove = function(s) {
for (var i = 0; i < this.length; i++) {
if (s == this[i])
this.splice(i, 1);
}
}
/**
* Simple Map
*
*
* var m = new Map();
* m.put('key','value');
* ...
* var s = "";
* m.each(function(key,value,index){
* s += index+":"+ key+"="+value+"\n";
* });
* alert(s);
*
* @author dewitt
* @date 2008-05-24
*/
function Map() {
/** 存放键的数组(遍历用到) */
this.keys = new Array();
/** 存放数据 */
this.data = new Object();
/**
* 攑օ一个键值对
* @param {String} key
* @param {Object} value
*/
this.put = function(key, value) {
if(this.data[key] == null){
this.keys.push(key);
}
this.data[key] = value;
};
/**
* 获取某键对应的?
* @param {String} key
* @return {Object} value
*/
this.get = function(key) {
return this.data[key];
};
/**
* 删除一个键值对
* @param {String} key
*/
this.remove = function(key) {
this.keys.remove(key);
this.data[key] = null;
};
/**
* 遍历Map,执行处理函数
*
* @param {Function} 回调函数 function(key,value,index){..}
*/
this.each = function(fn){
if(typeof fn != 'function'){
return;
}
var len = this.keys.length;
for(var i=0;i<len;i++){
var k = this.keys[i];
fn(k,this.data[k],i);
}
};
/**
* 获取键值数l?cMJava的entrySet())
* @return 键值对象{key,value}的数l?
*/
this.entrys = function() {
var len = this.keys.length;
var entrys = new Array(len);
for (var i = 0; i < len; i++) {
entrys[i] = {
key : this.keys[i],
value : this.data[i]
};
}
return entrys;
};
/**
* 判断Map是否为空
*/
this.isEmpty = function() {
return this.keys.length == 0;
};
/**
* 获取键值对数量
*/
this.size = function(){
return this.keys.length;
};
/**
* 重写toString
*/
this.toString = function(){
var s = "{";
for(var i=0;i<this.keys.length;i++,s+=','){
var k = this.keys[i];
s += k+"="+this.data[k];
}
s+="}";
return s;
};
}
function testMap(){
var m = new Map();
m.put('key1','Comtop');
m.put('key2','南方늽');
m.put('key3','景新花园');
alert("init:"+m);
m.put('key1','h?);
alert("set key1:"+m);
m.remove("key2");
alert("remove key2: "+m);
var s ="";
m.each(function(key,value,index){
s += index+":"+ key+"="+value+"\n";
});
alert(s);
}
一、球拍和球的ȝ?.1q,球拍比球?元, 那么球的h是多?Q?br />
二、如?台机器用?分钟来生?个零Ӟ那么100台机器生?00个零仉要用多少分钟 Q?br />
三、在一个湖里有一睡Ԍ睡莲的面U每天扩大一倍。如果睡莲覆盖整个湖需?8天,那么它覆盖半个湖需要多天 Q?br />
直觉告诉我们Q?{案分别是:0 .1元, 100分钟?4天?国研究人员吧这三道题杂在问卷中让10所大学?000多名本科生解{, 发现大部分h都凭直觉回答?但是直觉是错的?正确的答案分别是Q?0.05元?分钟?7天?按答对一题的一分计,q些学生的^均分值得1.24分。即使是那些l出正确{案的hQ?往往也是首先惛_直觉的答案, 然后意识到这个答案是错误的, 才找到违反直觉的正确{案。直觉其实是一U无意识的本能反应, 不经思考快速地自发产生Q不受h的心理状态的影响。理性思维则需要做有意识的思会被考。反应要慢得多。直觉对我们的生存至关重要?我们看到一张脸Q不可能要经q思考才能L认出是熟人;看到一块石头迎面砸来, 不可能等到想起会被砸伤才w开。这些都要靠直觉做出快速的自发反应。但是在面更复杂的问题时就需要用到理性思维才能解决?br />
在生zM我们交替使用q两套思维pȝ。例如,我们讲母语时Q用的是直觉思维Q而讲外语是用的是理性思维Q因此不可能像讲母语那么利。我们听到气象员用摄氏报出气温时Q会直觉感到气温的高低,但是如果听到的是华氏温度Q就要用到理性思维了——美国h则相反,通过反复的训l,有可能让理性思维转化成直觉?例如Qh们在学开车时Q要靠理性思维q行判断Q反应比较慢Q开车时间长了,在某U程度上成了一U本能,h速度的应变能力?br />
但是有时对同一个问题,直觉和理性思维会给出相互冲H的{案Q而直觉往往战胜理性,从而让Z生烦恹{?img src ="http://www.aygfsteel.com/nikita/aggbug/339802.html" width = "1" height = "1" />
W一点徏议,“不要急于L”?6岁的 所|门_“丢东西的第一反应可能是翻倒柜QO无目的的胡ؕ折腾Q这是很多h常犯的错误”?br />
W二点徏议道Z所|门ȝ学的_֍。“东西没有丢Q丢q是你正常的思维”。他_“没有丢q东四Q只有不会找的h”。所以,我们不得不接U第三个Q盲目的恐慌会遮蔽我们的眼睛。开始寻找之前,一定要心态^和,自信满满。不妨先坐下来喝Ӟ然后开始忙zR?br />
四很单, “东西经怼呆在最初的地方Q”这位哈弗大学高材生_“你是不是有存放东西的固定地点?如果有,先找那里Q?别让眼睛左右有你的思维。外套可能就攑֜常用的衣架上Q字典可能就攑֜书桌上。?br />
至于W五点徏议,大家或许都有cM的经验。“当你心l^静下来时Q?你或怼奇迹般的记v丢失的东ѝ突然记赯己没有丢Q?只是N了位|。?br />
有的时候,像W六点徏议的那样Q你可能正在直勾勄盯着要找的东西,却就是“看”不见。“当一个h急匆匆、思维处于高度Ȁ动状态时Q?很容易成为‘睁眼瞎’。看不到要找的东ѝ请再仔l地L一遍。?br />
所以,当你嘴里嘟哝着“R钥匙”的时候,牢记W七点徏?“遮蔽效应”。R钥匙其实在你认为的地方Q?只不q被某个物体盖住??br />
“掀开M能遮挡东西的物品Q如报纸Q如果还没有Q那么采U第八点。”有的东西只是稍微挪动了一点位|,虽然很小Q?却以让他们逃离你的视线?藏在打字Z的铅W,攑֜抽屉最里面的工L{。“根据我们的观察Q东西挪动的距离不超q?8英寸Q以18英寸为半径画圆, 仔细在这个区域查找, 胜利的概率就比较大。?br />
W九点徏议寓于常识之中,当你丢失东西Ӟ好好x丢在哪儿。“当你精疲力的遍所有的地方Q?没有发现蛛丝马迹Ӟ你得到最l的l论Q?也就是第十条Q不是你的错。换句话_是别h借了你的雨伞Q吃了你的a炸圈Q拿C你的车钥匙。?br />
“其实还有第十一点徏议,”所|门_“无论如何, 有些时候, 命运会选择把某些东西从你的财中永久的拿走?接受q一点, 然后l箋自己的生zR?br />
On this page:
Out Of Memory Errors
In the following, you will be required to set your memory settings via your FISHEYE_OPTS Environment Variables.
You will need to restart your server after setting your FISHEYE_OPTS.
OutOfMemoryError: Java Heap Space
If you are running Fisheye/Crucible as a windows service, increasing memory needs to be done in the wrapper.conf file. Refere to the Can Fisheye be run as a Windows Service for instructions.
OutOfMemoryError: PermGen space, or Permanent Generation Size
OutOfMemoryError: unable to create new native thread
For Linux the maximum heap size of the JVM cannot be greater than 2GB. If you only have 2GB RAM in your server, it is not recommended to set the Max size of the JVM that high.
The size of the stack per thread can also contribute to this problem. The stack size can reduce the number of threads that can be created.
The stack size can be changed with the following (example) parameter being added to your FISHEYE_OPTS:OutOfMemoryError: GC overhead limit exceeded
This kind of OutOfMemoryError can be caused if your java process is starting to use swapped memory for its heap. This will cause the JVM to take a lot longer than normal to perform normal GC operations. This can eventually cause a timeout to occur and cause this error.
java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?
Read the Tuning FishEye page for more detail on adjusting resource limits and performance settings in FishEye.
源自 Q?a >http://confluence.atlassian.com/display/FISHEYE/Fix+Out+of+Memory+errors+by+increasing+available+memory#FixOutofMemoryerrorsbyincreasingavailablememory-OutOfMemoryError%3Aunabletocreatenewnativethread,
In today's world, a typical enterprise application will have multiple components and will be distributed across various systems and networks. In Java, everything is represented as objects; if two Java components want to communicate with each other, there needs be a mechanism to exchange data. One way to achieve this is to define your own protocol and transfer an object. This means that the receiving end must know the protocol used by the sender to re-create the object, which would make it very difficult to talk to third-party components. Hence, there needs to be a generic and efficient protocol to transfer the object between components. Serialization is defined for this purpose, and Java components use this protocol to transfer objects.
Figure 1 shows a high-level view of client/server communication, where an object is transferred from the client to the server through serialization.
In order to serialize an object, you need to ensure that the class of the object implements the java.io.Serializable
interface, as shown in Listing 1.
import java.io.Serializable;
class TestSerial implements Serializable {
public byte version = 100;
public byte count = 0;
}
In Listing 1, the only thing you had to do differently from creating a normal class is implement the java.io.Serializable
interface. The Serializable
interface is a marker interface; it declares no methods at all. It tells the serialization mechanism that the class can be serialized.
Now that you have made the class eligible for serialization, the next step is to actually serialize the object. That is done by calling the writeObject()
method of the java.io.ObjectOutputStream
class, as shown in Listing 2.
public static void main(String args[]) throws IOException {
FileOutputStream fos = new FileOutputStream("temp.out");
ObjectOutputStream oos = new ObjectOutputStream(fos);
TestSerial ts = new TestSerial();
oos.writeObject(ts);
oos.flush();
oos.close();
}
Listing 2 stores the state of the TestSerial
object in a file called temp.out
. oos.writeObject(ts);
actually kicks off the serialization algorithm, which in turn writes the object to temp.out
.
To re-create the object from the persistent file, you would employ the code in Listing 3.
public static void main(String args[]) throws IOException {
FileInputStream fis = new FileInputStream("temp.out");
ObjectInputStream oin = new ObjectInputStream(fis);
TestSerial ts = (TestSerial) oin.readObject();
System.out.println("version="+ts.version);
}
In Listing 3, the object's restoration occurs with the oin.readObject()
method call. This method call reads in the raw bytes that we previously persisted and creates a live object that is an exact replica of the original object graph. Because readObject()
can read any serializable object, a cast to the correct type is required.
Executing this code will print version=100
on the standard output.
What does the serialized version of the object look like? Remember, the sample code in the previous section saved the serialized version of the TestSerial
object into the file temp.out
. Listing 4 shows the contents of temp.out
, displayed in hexadecimal. (You need a hexadecimal editor to see the output in hexadecimal format.)
AC ED 00 05 73 72 00 0A 53 65 72 69 61 6C 54 65
73 74 A0 0C 34 00 FE B1 DD F9 02 00 02 42 00 05
63 6F 75 6E 74 42 00 07 76 65 72 73 69 6F 6E 78
70 00 64
If you look again at the actual TestSerial
object, you'll see that it has only two byte members, as shown in Listing 5.
public byte version = 100;
public byte count = 0;
The size of a byte variable is one byte, and hence the total size of the object (without the header) is two bytes. But if you look at the size of the serialized object in Listing 4, you'll see 51 bytes. Surprise! Where did the extra bytes come from, and what is their significance? They are introduced by the serialization algorithm, and are required in order to to re-create the object. In the next section, you'll explore this algorithm in detail.
By now, you should have a pretty good knowledge of how to serialize an object. But how does the process work under the hood? In general the serialization algorithm does the following:
java.lang.object
.
I've written a different example object for this section that will cover all possible cases. The new sample object to be serialized is shown in Listing 6.
class parent implements Serializable {
int parentVersion = 10;
}
class contain implements Serializable{
int containVersion = 11;
}
public class SerialTest extends parent implements Serializable {
int version = 66;
contain con = new contain();
public int getVersion() {
return version;
}
public static void main(String args[]) throws IOException {
FileOutputStream fos = new FileOutputStream("temp.out");
ObjectOutputStream oos = new ObjectOutputStream(fos);
SerialTest st = new SerialTest();
oos.writeObject(st);
oos.flush();
oos.close();
}
}
This example is a straightforward one. It serializes an object of type SerialTest
, which is derived from parent
and has a container object, contain
. The serialized format of this object is shown in Listing 7.
AC ED 00 05 73 72 00 0A 53 65 72 69 61 6C 54 65
73 74 05 52 81 5A AC 66 02 F6 02 00 02 49 00 07
76 65 72 73 69 6F 6E 4C 00 03 63 6F 6E 74 00 09
4C 63 6F 6E 74 61 69 6E 3B 78 72 00 06 70 61 72
65 6E 74 0E DB D2 BD 85 EE 63 7A 02 00 01 49 00
0D 70 61 72 65 6E 74 56 65 72 73 69 6F 6E 78 70
00 00 00 0A 00 00 00 42 73 72 00 07 63 6F 6E 74
61 69 6E FC BB E6 0E FB CB 60 C7 02 00 01 49 00
0E 63 6F 6E 74 61 69 6E 56 65 72 73 69 6F 6E 78
70 00 00 00 0B
Figure 2 offers a high-level look at the serialization algorithm for this scenario.
Let's go through the serialized format of the object in detail and see what each byte represents. Begin with the serialization protocol information:
AC ED
: STREAM_MAGIC
. Specifies that this is a serialization protocol.
00 05
: STREAM_VERSION
. The serialization version.
0x73
: TC_OBJECT
. Specifies that this is a new Object
. The first step of the serialization algorithm is to write the description of the class associated with an instance. The example serializes an object of type SerialTest
, so the algorithm starts by writing the description of the SerialTest
class.
0x72
: TC_CLASSDESC
. Specifies that this is a new class.
00 0A
: Length of the class name.
53 65 72 69 61 6c 54 65 73 74
: SerialTest
, the name of the class.
05 52 81 5A AC 66 02 F6
: SerialVersionUID
, the serial version identifier of this class.
0x02
: Various flags. This particular flag says that the object supports serialization.
00 02
: Number of fields in this class. Next, the algorithm writes the field int version = 66;
.
0x49
: Field type code. 49 represents "I", which stands for Int
.
00 07
: Length of the field name.
76 65 72 73 69 6F 6E
: version
, the name of the field. And then the algorithm writes the next field, contain con = new contain();
. This is an object, so it will write the canonical JVM signature of this field.
0x74
: TC_STRING
. Represents a new string.
00 09
: Length of the string.
4C 63 6F 6E 74 61 69 6E 3B
: Lcontain;
, the canonical JVM signature.
0x78
: TC_ENDBLOCKDATA
, the end of the optional block data for an object. The next step of the algorithm is to write the description of the parent
class, which is the immediate superclass of SerialTest
.
0x72
: TC_CLASSDESC
. Specifies that this is a new class.
00 06
: Length of the class name.
70 61 72 65 6E 74
: SerialTest
, the name of the class
0E DB D2 BD 85 EE 63 7A
: SerialVersionUID
, the serial version identifier of this class.
0x02
: Various flags. This flag notes that the object supports serialization.
00 01
: Number of fields in this class. Now the algorithm will write the field description for the parent
class. parent
has one field, int parentVersion = 100;
.
0x49
: Field type code. 49 represents "I", which stands for Int
.
00 0D
: Length of the field name.
70 61 72 65 6E 74 56 65 72 73 69 6F 6E
: parentVersion
, the name of the field.
0x78
: TC_ENDBLOCKDATA
, the end of block data for this object.
0x70
: TC_NULL
, which represents the fact that there are no more superclasses because we have reached the top of the class hierarchy. So far, the serialization algorithm has written the description of the class associated with the instance and all its superclasses. Next, it will write the actual data associated with the instance. It writes the parent class members first:
00 00 00 0A
: 10, the value of parentVersion
. Then it moves on to SerialTest
.
00 00 00 42
: 66, the value of version
. The next few bytes are interesting. The algorithm needs to write the information about the contain
object, shown in Listing 8.
contain con = new contain();
Remember, the serialization algorithm hasn't written the class description for the contain
class yet. This is the opportunity to write this description.
0x73
: TC_OBJECT
, designating a new object.
0x72
: TC_CLASSDESC
.
00 07
: Length of the class name.
63 6F 6E 74 61 69 6E
: contain
, the name of the class.
FC BB E6 0E FB CB 60 C7
: SerialVersionUID
, the serial version identifier of this class.
0x02
: Various flags. This flag indicates that this class supports serialization.
00 01
: Number of fields in this class. Next, the algorithm must write the description for contain
's only field, int containVersion = 11;
.
0x49
: Field type code. 49 represents "I", which stands for Int
.
00 0E
: Length of the field name.
63 6F 6E 74 61 69 6E 56 65 72 73 69 6F 6E
: containVersion
, the name of the field.
0x78
: TC_ENDBLOCKDATA
. Next, the serialization algorithm checks to see if contain
has any parent classes. If it did, the algorithm would start writing that class; but in this case there is no superclass for contain
, so the algorithm writes TC_NULL
.
0x70
: TC_NULL
. Finally, the algorithm writes the actual data associated with contain
.
00 00 00 0B
: 11, the value of containVersion
. In this tip, you have seen how to serialize an object, and learned how the serialization algorithm works in detail. I hope this article gives you more detail on what happens when you actually serialize an object.
From Q?http://www.javaworld.com/community/node/2915