Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding a new item (number 11) that explains why it's important to use

emalloc() and friends in place of the standard C library functions.
  • Loading branch information...
commit e79772d6e047b56a018ce3d295c552c12092bcd2 1 parent 2f88f50
Jon Parise jparise authored

Showing 1 changed file with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. +13 0 CODING_STANDARDS
13 CODING_STANDARDS
@@ -122,6 +122,19 @@ Exceptions:
122 122 existing. End users should use function_exists() to test for the
123 123 existence of a function
124 124
  125 +[11] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
  126 + counterparts. These functions implement an internal "safety-net"
  127 + mechanism that ensures the deallocation of any unfreed memory at the
  128 + end of a request. They also provide useful allocation and overflow
  129 + information while running in debug mode.
  130 +
  131 + In almost all cases, memory returned to the engine must be allocated
  132 + using emalloc().
  133 +
  134 + The use of malloc() should be limited to cases where a third-party
  135 + library may need to control or free the memory, or when the memory in
  136 + question needs to survive between multiple requests.
  137 +
125 138 Naming Conventions
126 139 ------------------
127 140

0 comments on commit e79772d

Please sign in to comment.
Something went wrong with that request. Please try again.