diff packages/services/memalloc/common/current/include/mvarimpl.inl @ 1687:eb235374a7ae

2004-06-24 Oyvind Harboe <oyvind.harboe@zylin.com> * Added cyg_memalloc_alloc_fail() fn which is invoked before return NULL from failed allocations. Useful breakpoint site. Andrew Lunn wrote some of the code and pointed out various wrinkles to be ironed out.
author asl
date Mon, 05 Jul 2004 11:07:04 +0000
parents d2c90368aeef
children
line wrap: on
line diff
--- a/packages/services/memalloc/common/current/include/mvarimpl.inl
+++ b/packages/services/memalloc/common/current/include/mvarimpl.inl
@@ -275,6 +275,8 @@ Cyg_Mempool_Variable_Implementation::try
     cyg_uint8 *ptr = memdq2alloc( dq );
     CYG_ASSERT( ((CYG_ADDRESS)ptr & (alignment-1)) == 0,
                 "returned memory not aligned" );
+    CYG_MEMALLOC_FAIL_TEST(ptr==NULL, size);
+
     return ptr;
 }
 
@@ -358,6 +360,8 @@ Cyg_Mempool_Variable_Implementation::res
         ret = alloc_ptr;
     }
         
+    CYG_MEMALLOC_FAIL_TEST(ret==NULL, newsize);
+
     return ret;
 
 } // resize_alloc()