venti-mem 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 (2).
  39. They do not return.
  40. .PP
  41. .I Vtbrk
  42. returns a pointer to a new, permanently allocated block of at least
  43. .I size
  44. bytes.
  45. .PP
  46. .IR Vtmalloc ,
  47. .IR vtrealloc ,
  48. and
  49. .I vtstrdup
  50. are like
  51. .IR malloc ,
  52. .IR realloc ,
  53. and
  54. .IR strdup ,
  55. but, as noted above, do not return on error.
  56. .I Vtmallocz
  57. is like
  58. .I vtmalloc
  59. but zeros the block before returning it.
  60. Memory allocated with all four should be freed with
  61. .I vtfree
  62. when no longer needed.
  63. .SH SOURCE
  64. .B /sys/src/libventi
  65. .SH SEE ALSO
  66. .IR venti (2)