summaryrefslogtreecommitdiff
path: root/CODING_STANDARDS
diff options
context:
space:
mode:
authorJon Parise <jon@php.net>2002-10-10 17:03:49 (GMT)
committerJon Parise <jon@php.net>2002-10-10 17:03:49 (GMT)
commite79772d6e047b56a018ce3d295c552c12092bcd2 (patch)
treebc18cb732eecab642eda41998e060b2113deec2b /CODING_STANDARDS
parent2f88f504c1b3ec9a2513c84239019a582a11231e (diff)
downloadphp-e79772d6e047b56a018ce3d295c552c12092bcd2.tar.gz
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.
Diffstat (limited to 'CODING_STANDARDS')
-rw-r--r--CODING_STANDARDS13
1 files changed, 13 insertions, 0 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index 826d7e4..077f997 100644
--- a/CODING_STANDARDS
+++ b/CODING_STANDARDS
@@ -122,6 +122,19 @@ Exceptions:
existing. End users should use function_exists() to test for the
existence of a function
+[11] Prefer emalloc(), efree(), estrdup(), etc. to their standard C library
+ counterparts. These functions implement an internal "safety-net"
+ mechanism that ensures the deallocation of any unfreed memory at the
+ end of a request. They also provide useful allocation and overflow
+ information while running in debug mode.
+
+ In almost all cases, memory returned to the engine must be allocated
+ using emalloc().
+
+ The use of malloc() should be limited to cases where a third-party
+ library may need to control or free the memory, or when the memory in
+ question needs to survive between multiple requests.
+
Naming Conventions
------------------