diff src/org/tmatesoft/hg/core/Nodeid.java @ 197:3a7696fb457c

Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 19 Apr 2011 03:49:29 +0200
parents 71ddbf8603e8
children 4b661efb9374
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/Nodeid.java	Mon Apr 18 18:04:24 2011 +0200
+++ b/src/org/tmatesoft/hg/core/Nodeid.java	Tue Apr 19 03:49:29 2011 +0200
@@ -46,11 +46,23 @@
 	 */
 	public Nodeid(byte[] binaryRepresentation, boolean shallClone) {
 		// 5 int fields => 32 bytes
-		// byte[20] => 48 bytes
+		// byte[20] => 48 bytes (16 bytes is Nodeid with one field, 32 bytes for byte[20] 
 		if (binaryRepresentation == null || binaryRepresentation.length != 20) {
 			throw new IllegalArgumentException();
 		}
-		this.binaryData = shallClone ? binaryRepresentation.clone() : binaryRepresentation;
+		/*
+		 * byte[].clone() is not reflected when ran with -agentlib:hprof=heap=sites
+		 * thus not to get puzzled why there are N Nodeids and much less byte[] instances,
+		 * may use following code to see N byte[] as well.
+		 *
+		if (shallClone) {
+			binaryData = new byte[20];
+			System.arraycopy(binaryRepresentation, 0, binaryData, 0, 20);
+		} else {
+			binaryData = binaryRepresentation;
+		}
+		*/
+		binaryData = shallClone ? binaryRepresentation.clone() : binaryRepresentation;
 	}
 
 	@Override