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

Re: [PATCH v3 2/2] read-cache: plug a few leaks

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 8, 2013, 16:53 UTC
Message-ID
<CAMP44s3UYCX+DzgnErB=0GdD3w5k2GkNKjv46ZA_NVHm1Z0YLQ@mail.gmail.com>
In-Reply-To
<51B35414.1090101@lsrfire.ath.cx>

On Sat, Jun 8, 2013 at 10:56 AM, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:

Show 22 quoted lines
> Am 08.06.2013 16:04, schrieb Felipe Contreras:
>
>> On Sat, Jun 8, 2013 at 8:22 AM, René Scharfe
>> <rene.scharfe@lsrfire.ath.cx> wrote:
>>>
>>> Am 08.06.2013 14:15, schrieb Felipe Contreras:
>>
>>
>>>> Why leave it out? If somebody makes the mistake of doing the above
>>>> sequence, would you prefer that we leak?
>>>
>>>
>>> Leaking is better than silently cleaning up after a buggy caller because
>>> it
>>> still allows the underlying bug to be found.
>>
>>
>> No, it doesn't. The pointer is replaced and forever lost. How is
>> leaking memory helping anyone to find the bug?
>
> Valgrind can tell you where leaked memory was allocated, but not if you free
> it in the "wrong" place.

It is the correct place to free it. And nobody will ever find it with valgrind, just like nobody has ever tracked down the hundreds of leaks in Git that happen reliably 100% of the time, much less the ones that happen rarely.

-- 
Felipe Contreras
Previous: René ScharfeNext: René Scharfe
Message 9 of 16 in “cherry-pick: fix memory leaks”
  1. 0/2 cherry-pick: fix memory leaksFelipe Contreras, Jun 7, 2013
  2. 1/2 unpack-trees: plug a memory leakFelipe Contreras, Jun 7, 2013
  3. 2/2 read-cache: plug a few leaksFelipe Contreras, Jun 7, 2013
  4. René ScharfeJun 8, 2013
  5. Felipe ContrerasJun 8, 2013
  6. René ScharfeJun 8, 2013
  7. Felipe ContrerasJun 8, 2013
  8. René ScharfeJun 8, 2013
  9. Felipe ContrerasJun 8, 2013
  10. René ScharfeJun 8, 2013
  11. Felipe ContrerasJun 8, 2013
  12. René ScharfeJun 9, 2013
  13. Felipe ContrerasJun 9, 2013
  14. René ScharfeJun 9, 2013
  15. Felipe ContrerasJun 9, 2013
  16. Junio C HamanoJun 9, 2013

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.