Thread

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add more assertions in palloc0() and palloc_extended()

  1. Add assertion for failed alloc to palloc0() and palloc_extended()

    Andreas Karlsson <andreas@proxel.se> — 2025-03-01T00:05:43Z

    Hi,
    
    I noticed that we have Assert(ret != NULL) in palloc() but not in 
    palloc0() so for consistency I decided to add it. I also added an 
    assertion that the MCXT_ALLOC_NO_OOM flag is set if alloc() returns
    NULL to palloc_extended().
    
    I feel that this might be useful since while palloc() is much more 
    common the OOM which causes alloc() to incorrectly return NULL could in 
    theory happen in any of the three functions.
    
    Andreas
    
  2. Re: Add assertion for failed alloc to palloc0() and palloc_extended()

    Michael Paquier <michael@paquier.xyz> — 2025-03-03T04:13:05Z

    On Sat, Mar 01, 2025 at 01:05:43AM +0100, Andreas Karlsson wrote:
    > I noticed that we have Assert(ret != NULL) in palloc() but not in palloc0()
    > so for consistency I decided to add it. I also added an assertion that the
    > MCXT_ALLOC_NO_OOM flag is set if alloc() returns
    > NULL to palloc_extended().
    > 
    > I feel that this might be useful since while palloc() is much more common
    > the OOM which causes alloc() to incorrectly return NULL could in theory
    > happen in any of the three functions.
    
    Hmm.  Good points.  All the MemoryContextMethods rely on
    MemoryContextAllocationFailure() to handle the case of
    MCXT_ALLOC_NO_OOM on failure (except alignedalloc which has no alloc 
    routine).  Your two suggestions, one in palloc0() for the non-NULL
    check, and the second one in palloc_extended() to make sure that we
    have MCXT_ALLOC_NO_OOM set when the result is NULL, could catch
    inconsistencies when implementing a new method.
    
    In short, LGTM.  Will apply if there are no objections.
    --
    Michael
    
  3. Re: Add assertion for failed alloc to palloc0() and palloc_extended()

    Michael Paquier <michael@paquier.xyz> — 2025-03-04T02:01:34Z

    On Mon, Mar 03, 2025 at 01:13:05PM +0900, Michael Paquier wrote:
    > In short, LGTM.  Will apply if there are no objections.
    
    And applied as 40d3f8274499.
    --
    Michael
    
  4. Re: Add assertion for failed alloc to palloc0() and palloc_extended()

    Andreas Karlsson <andreas@proxel.se> — 2025-03-04T08:52:14Z

    On 3/4/25 3:01 AM, Michael Paquier wrote:
    > On Mon, Mar 03, 2025 at 01:13:05PM +0900, Michael Paquier wrote:
    >> In short, LGTM.  Will apply if there are no objections.
    > 
    > And applied as 40d3f8274499.
    
    Thanks!
    
    Andreas