summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/util/prdfFlyWeightS.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/diag/prdf/common/util/prdfFlyWeightS.C')
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFlyWeightS.C18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeightS.C b/src/usr/diag/prdf/common/util/prdfFlyWeightS.C
index 8a8a73789..325fa729b 100755
--- a/src/usr/diag/prdf/common/util/prdfFlyWeightS.C
+++ b/src/usr/diag/prdf/common/util/prdfFlyWeightS.C
@@ -24,6 +24,8 @@
#include <prdfFlyWeightS.H>
#include <algorithm>
#include <prdfHeapBucketSize.H>
+#include <prdfTrace.H>
+#include <prdfAssert.h>
namespace PRDF
{
@@ -201,7 +203,13 @@ T * FlyWeightS<T,S>::getHeap()
if (NULL == iv_nextPos)
{
- iv_heaps.push_back(iv_nextPos = new T[RoundBucketSize<T,S>::value]);
+ iv_nextPos = new T[RoundBucketSize<T,S>::value];
+ if( NULL == iv_nextPos )
+ {
+ PRDF_ERR("Can not allocate memory on heap");
+ PRDF_ASSERT( NULL != iv_nextPos );
+ }
+ iv_heaps.push_back(iv_nextPos);
}
T * l_rc = iv_nextPos;
@@ -209,7 +217,13 @@ T * FlyWeightS<T,S>::getHeap()
iv_nextPos++;
if ((static_cast<T*>(*(iv_heaps.end()-1)) + RoundBucketSize<T,S>::value) == iv_nextPos)
{
- iv_heaps.push_back(iv_nextPos = new T[RoundBucketSize<T,S>::value]);
+ iv_nextPos = new T[RoundBucketSize<T,S>::value];
+ if( NULL == iv_nextPos )
+ {
+ PRDF_ERR("Can not allocate memory on heap");
+ PRDF_ASSERT( NULL != iv_nextPos );
+ }
+ iv_heaps.push_back(iv_nextPos);
}
return l_rc;
OpenPOWER on IntegriCloud