Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, and you can also have multiple parents with a reference-count semantics.

  void * talloc_steal(const void * new_ctx, const void * ptr);

  The talloc_steal() function changes the parent context of a talloc
  pointer. It is typically used when the context that the pointer is
  currently a child of is going to be freed and you wish to keep the
  memory for a longer time.

  NOTE: It is possible to produce loops in the parent/child relationship
  if you are not careful with talloc_steal(). No guarantees are provided
  as to your sanity or the safety of your data if you do this.
There's also talloc_reparent where you explicitly choose the parent to change.


This is nice!! Thanks!!




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: