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

Re: [PATCH] repository: fix free problem with repo_clear(the_repository)

From
Stefan Beller <sbeller@google.com>
Date
May 9, 2018, 18:09 UTC
Message-ID
<CAGZ79kZvG4+=Mx24-HWdsaxsiKS_3YynKDnTB1b-a3kLvM16Xw@mail.gmail.com>
In-Reply-To
<CACsJy8AdJcQpiGrR3p6xfuqU0=qoP3=StgbWRNCkdfka6di+5w@mail.gmail.com>
On Wed, May 9, 2018 at 11:00 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 8 quoted lines
> On Wed, May 9, 2018 at 7:50 PM, Stefan Beller <sbeller@google.com> wrote:
>>>  I was trying to test the new parsed_object_pool_clear() and found this.
>>
>> So this would go with the latest sb/object-store-alloc ?
>
> No this should be separate because sb/object-store-alloc did not even
> touch this code. I mistakenly thought you wrote this and sent to you.
> I should have checked and sent to Brandon instead.

Yes, they do not produce merge conflicts and do not semantically rely on each other. Except as noted below the object store series complicated things in a non-latest version of it, such that we'd have to add more special casing. Now everything is fine.

Show 6 quoted lines
>> I would rather special case the_repository even more instead
>> of having it allocate all its things on the heap. (However we rather
>> want to profile it and argue with data....)
>
> I'm actually going the opposite direction and trying hard to make
> the_repository normal like everybody else :)

ok, both Brandon and you want to do this, so I guess we'll just go this route for now.

Show 10 quoted lines
>
> discard_index(repo->index);
> if (repo->index != &the_index)
>         FREE_AND_NULL(repo->index);
>
>> What is your use case of repo_clear(the_repository)?
>
> No actual use case right now. See [1] for the code that triggered
> this. I do want to free some memory in pack-objects and repo_clear()
> _might_ be the one. I'm not sure yet.

This diff seems good to me. as any repo is cleared and wil have the minimal amount of memory. the_repository clears its the_index which is also fine as it has the minimal amount of memory then, too

Thanks, Stefan

Previous: Duy NguyenNext: Duy Nguyen
Message 7 of 11 in “repository: fix free problem with repo_clear(the_repository)”
  1. repository: fix free problem with repo_clear(the_repository)Nguyễn Thái Ngọc Duy, May 9, 2018
  2. Brandon WilliamsMay 9, 2018
  3. Elijah NewrenMay 9, 2018
  4. Duy NguyenMay 9, 2018
  5. Stefan BellerMay 9, 2018
  6. Duy NguyenMay 9, 2018
  7. Stefan BellerMay 9, 2018
  8. Duy NguyenMay 10, 2018
  9. Junio C HamanoMay 10, 2018
  10. Stefan BellerMay 10, 2018
  11. repository: fix free problem with repo_clear(the_repository)Nguyễn Thái Ngọc Duy, May 10, 2018

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.