reference-libobs-util-bmem.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Memory Management
  2. =================
  3. Various functions and helpers used for memory management.
  4. .. code:: cpp
  5. #include <util/bmem.h>
  6. Memory Functions
  7. ----------------
  8. .. function:: void *bmalloc(size_t size)
  9. Allocates memory and increases the memory leak counter.
  10. ---------------------
  11. .. function:: void *brealloc(void *ptr, size_t size)
  12. Reallocates memory. Use only with memory that's been allocated by
  13. :c:func:`bmalloc()`.
  14. ---------------------
  15. .. function:: void bfree(void *ptr)
  16. Frees memory allocated with :c:func:`bmalloc()`.
  17. ---------------------
  18. .. function:: long bnum_allocs(void)
  19. Returns current number of active allocations.
  20. ---------------------
  21. .. function:: void *bmemdup(const void *ptr, size_t size)
  22. Duplicates memory.
  23. ---------------------
  24. .. function:: void *bzalloc(size_t size)
  25. Inline function that allocates zeroed memory.
  26. ---------------------
  27. .. function:: char *bstrdup_n(const char *str, size_t n)
  28. wchar_t *bwstrdup_n(const wchar_t *str, size_t n)
  29. Duplicates a string of *n* bytes and automatically zero-terminates
  30. it.
  31. ---------------------
  32. .. function:: char *bstrdup(const char *str)
  33. wchar_t *bwstrdup(const wchar_t *str)
  34. Duplicates a string.