* src/base/ftdbgmem.c, docs/DEBUG.TXT: added new environment variables
    to control memory debugging with FreeType. See the description of
    "FT2_DEBUG_MEMORY", "FT2_ALLOC_TOTAL_MAX" and "FT2_ALLOC_COUNT_MAX"
    in DEBUG.TXT

    * src/cache/ftccache.c, src/cache/ftccmap.c, src/cache/ftcsbits.c,
    ftlru.c: fixed the cache sub-system to correctly deal with out-of-memory
    conditions.

    * src/pfr/pfrobjs.c, src/pfr/pfrsbits.c: fixing compiler warnings and a
    small memory leak

    * src/psaux/psobjs.c (t1_reallocate_table): fixed a bug (memory leak) that
    only happened when trying to resize an array would end in an OOM.

    * src/smooth/ftgrays.c: removed compiler warnings / volatile bug

    * src/truetype/ttobjs.c: removed segmentation fault that happened in
    tight memory environments.
diff --git a/docs/DEBUG.TXT b/docs/DEBUG.TXT
index ef7faa1..8996d66 100644
--- a/docs/DEBUG.TXT
+++ b/docs/DEBUG.TXT
@@ -159,4 +159,25 @@
     ignored in other builds.
 
 
+  FT2_ALLOC_TOTAL_MAX
+
+    this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
+    you to specify a maximum heap size for all memory allocations performed
+    by FreeType. This is very useful to test the robustness of the font
+    engine and programs that use it in tight memory conditions.
+    
+    If it is undefined, or if its value is not strictly positive, then no
+    allocation bounds are checked at runtime.
+
+
+  FT2_ALLOC_COUNT_MAX
+  
+    this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
+    you to sepcify a maximum number of memory allocations performed by
+    FreeType before returning the error FT_Err_Out_Of_Memory. This is
+    useful for debugging and testing the engine's robustness.
+    
+    If it is undefined, or if its value is not strictly positive, then no
+    allocation bounsd are checked at runtime.
+
 End of file