Re: [PATCH] Make object contents optionally available
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- May 17, 2005, 15:29 UTC
- Message-ID
- <Pine.LNX.4.58.0505170826061.18337@ppc970.osdl.org>
- In-Reply-To
- <Pine.LNX.4.21.0505170049480.30848-100000@iabervon.org>
On Tue, 17 May 2005, Daniel Barkalow wrote:
Show 7 quoted lines
> > This adds contents and size fields to struct object. If unpack_object is > called on an object, it will fill in the contents field with the complete > raw contents of the object. If free_object_contents is called on an > object, the contents will be freed. If contents is filled when an object > is parsed, it is not unpacked an extra time, but the contents are not > retained if they were not unpacked before parsing.
I really hate magic interfaces like that. It's just a bug waiting to happen.
I'd actually prefer it if "parse_object()" just always unpacks it, and leaves the unpacked thing in memory.
Then, the _few_ programs that really care about memory use because they parse potentially millions of objects (especially blobs, which obviously can be very large) can be updated to just do a manual "free_object_contents()". That's primarily things like fsck and convert-cache, I suspect.
That would leave a lot less special cases and strange rules..
Linus