git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/5] Add pack-objects window memory usage limit

From
Brian Downing <bdowning@lavos.net>
Date
Jul 12, 2007, 10:02 UTC
Message-ID
<20070712100251.GT4087@lavos.net>
In-Reply-To
<alpine.LFD.0.999.0707112356330.32552@xanadu.home>
On Thu, Jul 12, 2007 at 12:25:54AM -0400, Nicolas Pitre wrote:
Show 17 quoted lines
> On Wed, 11 Jul 2007, Brian Downing wrote:
> 
> > +		while (window_memory_limit &&
> > +		       window_memory_usage > window_memory_limit &&
> > +		       count > 1) {
> > +			uint32_t tail = idx - count;
> > +			if (tail > idx) {
> > +				tail += window + 1;
> > +				tail %= window;
> > +			}
> > +			free_unpacked(array + tail);
> > +			count--;
> > +		}
> 
> This is bogus.  Suppose window = 10 and only array entries 8, 9, 0, 1 
> and 2 are populated.  In that case idx = 2 and count should be 4 (not 
> counting the current entry yet).  You want to evict entry 8.

The current idx has already been depopulated by the time that code is run, and count is probably one higher than you are expecting, so this does actually work.

However, looking at it again, I think if the window hasn't been saturated yet in my current code count will be what you expect in this situation and it will screw up as you describe.

Besides, it is admittedly clumsy as hell (a common affliction when dealing with circular buffers for me it seems). I'll see if I can get something better that works.

Thanks, -bcd

Previous: Nicolas PitreNext: Brian Downing
Message 6 of 10 in “Memory-limited pack-object window support”
  1. 0/5 Memory-limited pack-object window supportBrian Downing, Jul 12, 2007
  2. 1/5 Don't try to delta if target is much smaller than sourceBrian Downing, Jul 12, 2007
  3. 2/5 Support fetching the memory usage of a delta indexBrian Downing, Jul 12, 2007
  4. 3/5 Add pack-objects window memory usage limitBrian Downing, Jul 12, 2007
  5. Nicolas PitreJul 12, 2007
  6. Brian DowningJul 12, 2007
  7. 4/5 Add --window-bytes option to git-repackBrian Downing, Jul 12, 2007
  8. 5/5 Add documentation for --window-bytes, pack.windowBytesBrian Downing, Jul 12, 2007
  9. Nicolas PitreJul 12, 2007
  10. Nicolas PitreJul 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.