Expose disposeBody() on RevCommit and RevTag
Applications that use a commit message once and do not need it again can free the body to save memory. Expose the disposeBody() methods to support this and use it in pgm.Log which only visits each commit once. Change-Id: I4142a0749c24f15386ee7fb119934a0432234de3
This commit is contained in:
parent
ca7daa5226
commit
e4e947049f
|
@ -267,6 +267,7 @@ protected void show(final RevCommit c) throws Exception {
|
||||||
outw.print(s);
|
outw.print(s);
|
||||||
outw.println();
|
outw.println();
|
||||||
}
|
}
|
||||||
|
c.disposeBody();
|
||||||
|
|
||||||
outw.println();
|
outw.println();
|
||||||
if (showNotes(c))
|
if (showNotes(c))
|
||||||
|
|
|
@ -609,7 +609,19 @@ public void reset() {
|
||||||
inDegree = 0;
|
inDegree = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final void disposeBody() {
|
/**
|
||||||
|
* Discard the message buffer to reduce memory usage.
|
||||||
|
* <p>
|
||||||
|
* After discarding the memory usage of the {@code RevCommit} is reduced to
|
||||||
|
* only the {@link #getTree()} and {@link #getParents()} pointers and the
|
||||||
|
* time in {@link #getCommitTime()}. Accessing other properties such as
|
||||||
|
* {@link #getAuthorIdent()}, {@link #getCommitterIdent()} or either message
|
||||||
|
* function requires reloading the buffer by invoking
|
||||||
|
* {@link RevWalk#parseBody(RevObject)}.
|
||||||
|
*
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public final void disposeBody() {
|
||||||
buffer = null;
|
buffer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,18 @@ public final String getTagName() {
|
||||||
return tagName;
|
return tagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
final void disposeBody() {
|
/**
|
||||||
|
* Discard the message buffer to reduce memory usage.
|
||||||
|
* <p>
|
||||||
|
* After discarding the memory usage of the {@code RevTag} is reduced to
|
||||||
|
* only the {@link #getObject()} pointer and {@link #getTagName()}.
|
||||||
|
* Accessing other properties such as {@link #getTaggerIdent()} or either
|
||||||
|
* message function requires reloading the buffer by invoking
|
||||||
|
* {@link RevWalk#parseBody(RevObject)}.
|
||||||
|
*
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public final void disposeBody() {
|
||||||
buffer = null;
|
buffer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue