krealloc_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– krealloc_array πŸ’–

okay so bestie, this is the Kernel API Manual page for krealloc_array, and she is literally here to reallocate memory for an array. iconic behavior. ✨

πŸŽ€ NAME πŸŽ€

  • krealloc_array β€” reallocate memory for an array πŸ’…

✨ SYNOPSIS ✨

void * krealloc_array (void *p , size_t new_n , size_t new_size , gfp_t
       flags );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • p β€” pointer to the memory chunk to reallocate 🫢
  • new_n β€” the new number of elements to alloc 🧚
  • new_size β€” the new size of a single member of the array 🌸
  • flags β€” the type of memory to allocate (see kmalloc) πŸ”₯

🌈 DESCRIPTION 🌈

okay so here's the vibe check on __GFP_ZERO β€” and ngl, this part matters. πŸ‘‘

⚠️ bestie, listen: if __GFP_ZERO logic is requested, callers must ensure that, starting with the initial memory allocation, every subsequent call to this API for the same memory allocation is flagged with __GFP_ZERO. Otherwise, it is possible that __GFP_ZERO is not fully honored by this API. πŸ’€

See krealloc_noprof for further details. 🫑

In any case, the contents of the object pointed to are preserved up to the lesser of the new and old sizes. no cap. πŸ’–

🌟 SEE ALSO 🌟

Kernel file ./include/linux/slab.h β€” say hi to the whole squad:


and that's the tea πŸ“ β€” this page comes from ./include/linux, dated October 2026, and it's still your girl krealloc_array(9). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from