venti-mem 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .TH VENTI-MEM 2
  2. .SH NAME
  3. vtbrk,
  4. vtmalloc,
  5. vtmallocz,
  6. vtrealloc,
  7. vtstrdup,
  8. vtfree \- error-checking memory allocators
  9. .SH SYNOPSIS
  10. .ft L
  11. #include <u.h>
  12. .br
  13. #include <libc.h>
  14. .br
  15. #include <venti.h>
  16. .ta +\w'\fLvoid* 'u
  17. .PP
  18. .B
  19. void* vtbrk(int size)
  20. .PP
  21. .B
  22. void* vtmalloc(int size)
  23. .PP
  24. .B
  25. void* vtmallocz(int size)
  26. .PP
  27. .B
  28. void* vtrealloc(void *ptr, int size)
  29. .PP
  30. .B
  31. char* vtstrdup(char *s)
  32. .PP
  33. .B
  34. void vtfree(void *ptr)
  35. .SH DESCRIPTION
  36. These routines allocate and free memory.
  37. On failure, they print an error message and call
  38. .IR sysfatal
  39. (from
  40. .IR perror (2)).
  41. They do not return.
  42. .PP
  43. .I Vtbrk
  44. returns a pointer to a new, permanently allocated block of at least
  45. .I size
  46. bytes.
  47. .PP
  48. .IR Vtmalloc ,
  49. .IR vtrealloc ,
  50. and
  51. .I vtstrdup
  52. are like
  53. .IR malloc ,
  54. .IR realloc ,
  55. and
  56. .IR strdup ,
  57. but, as noted above, do not return on error.
  58. .I Vtmallocz
  59. is like
  60. .I vtmalloc
  61. but zeros the block before returning it.
  62. Memory allocated with all four should be freed with
  63. .I vtfree
  64. when no longer needed.
  65. .SH SOURCE
  66. .B /sys/src/libventi
  67. .SH SEE ALSO
  68. .IR venti (2)