summaryrefslogtreecommitdiff
path: root/ndb/src/kernel/vm/ArrayPool.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ndb/src/kernel/vm/ArrayPool.hpp')
-rw-r--r--ndb/src/kernel/vm/ArrayPool.hpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp
index 924ed51ee15..f50617d9d7f 100644
--- a/ndb/src/kernel/vm/ArrayPool.hpp
+++ b/ndb/src/kernel/vm/ArrayPool.hpp
@@ -44,7 +44,7 @@ public:
*
* Note, can currently only be called once
*/
- bool setSize(Uint32 noOfElements);
+ bool setSize(Uint32 noOfElements, bool exit_on_error = true);
inline Uint32 getNoOfFree() const {
return noOfFree;
@@ -218,13 +218,19 @@ ArrayPool<T>::~ArrayPool(){
template <class T>
inline
bool
-ArrayPool<T>::setSize(Uint32 noOfElements){
+ArrayPool<T>::setSize(Uint32 noOfElements, bool exit_on_error){
if(size == 0){
if(noOfElements == 0)
return true;
theArray = (T *)NdbMem_Allocate(noOfElements * sizeof(T));
if(theArray == 0)
- return false;
+ {
+ if (!exit_on_error)
+ return false;
+ ErrorReporter::handleAssert("ArrayPool<T>::setSize malloc failed",
+ __FILE__, __LINE__, NDBD_EXIT_MEMALLOC);
+ return false; // not reached
+ }
size = noOfElements;
noOfFree = noOfElements;
@@ -247,7 +253,11 @@ ArrayPool<T>::setSize(Uint32 noOfElements){
return true;
}
- return false;
+ if (!exit_on_error)
+ return false;
+
+ ErrorReporter::handleAssert("ArrayPool<T>::setSize called twice", __FILE__, __LINE__);
+ return false; // not reached
}
template <class T>