* [PATCH] Distignuish between commit id and key in commit cache
@ 2007-03-12 17:51 Robin Rosenberg
2007-03-12 21:05 ` Shawn O. Pearce
0 siblings, 1 reply; 2+ messages in thread
From: Robin Rosenberg @ 2007-03-12 17:51 UTC (permalink / raw)
To: spearce; +Cc: git
See WeakHashMap documentation. If the key is the same object
as the objectid the keys can never be collected.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/jgit/lib/Repository.java | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index f7c470d..8b1f42c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -199,7 +199,9 @@ public class Repository {
final byte[] raw = or.getBytes();
if (Constants.TYPE_COMMIT.equals(or.getType())) {
ret = new Commit(this, id, raw);
- cache.put(id, ret);
+ // The key must not be the referenced strongly
+ // by the value in WeakHashMaps
+ cache.put(new ObjectId(id.getBytes()), ret);
return ret;
}
throw new IncorrectObjectTypeException(id, Constants.TYPE_COMMIT);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Distignuish between commit id and key in commit cache
2007-03-12 17:51 [PATCH] Distignuish between commit id and key in commit cache Robin Rosenberg
@ 2007-03-12 21:05 ` Shawn O. Pearce
0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2007-03-12 21:05 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> See WeakHashMap documentation. If the key is the same object
> as the objectid the keys can never be collected.
Thanks. I have applied this in the middle of your other recent
series, tagged 0.2.1 and pushed it out to the usual locations.
The history view looks pretty nice... and is reasonably quick too!
--
Shawn.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-12 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-12 17:51 [PATCH] Distignuish between commit id and key in commit cache Robin Rosenberg
2007-03-12 21:05 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).