Re: [PATCH] struct file cleanup : the very large file_ra_state is now allocated only on demand.

From: Nick Piggin (nickpiggin_at_yahoo.com.au)
Date: 08/18/05

  • Next message: Michael Krufky: "[PATCH] DVB: lgdt330x check callback fix"
    Date:	Thu, 18 Aug 2005 12:52:24 +1000
    To: Andi Kleen <ak@suse.de>
    
    

    Andi Kleen wrote:

    >
    >I would just set the ra pointer to a single global structure if the allocation
    >fails. Then you can avoid all the other checks. It will slow down
    >things and trash some state, but not fail and nobody should expect good
    >performance after out of memory anyways. The only check still
    >needed would be on freeing.
    >
    >

    You don't want to always have bad performance though, so you
    could attempt to allocate if either the pointer is null _or_ it
    points to the global structure?

    Send instant messages to your online friends http://au.messenger.yahoo.com
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Michael Krufky: "[PATCH] DVB: lgdt330x check callback fix"

    Relevant Pages

    • Re: when can realloc fail?
      ... null pointer or a pointer to the allocated space.". ... means that it will have to return NULL if it fails (a non-null ... pointer must point to the allocated space, but the allocation ... about successful allocation. ...
      (comp.lang.c)
    • Re: xmalloc string functions
      ... There is nothing to recover because failure of fopen ... then you can safely abortwhen fopenfails. ... doesn't have memory to draw stuff it draws. ... If a fairly large allocation fails, ...
      (comp.lang.c)
    • Re: (MS-)DOS PC on a microcontroller??
      ... memory block of zero bytes. ... The pointer returned if the ... Each such allocation shall yield a pointer to ... support malloc/calloc requests for 0 bytes and whether or not the ...
      (comp.arch.embedded)
    • Re: allocating memory for array of pointers to char
      ... >> checking up on allocation and so on, the types of your objects are ... > pointer inside a linked-list element. ... > typedef struct listelem_t { ... "value" is a pointer to an array of unknown length. ...
      (comp.lang.c)
    • Re: Strtol vs sscanf
      ... sscanf() format string. ... every pointer requires a dynamic allocation! ... > the malloc error's before exiting which variables failed to get ...
      (comp.lang.c)