trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sure...@apache.org
Subject [1/7] incubator-trafodion git commit: Create NACollection objects on NAHeap. Avoid use of system heap as far as possible
Date Tue, 11 Oct 2016 03:57:38 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 12f602cab -> e3c8d7e80


Create NACollection objects on NAHeap.
Avoid use of system heap as far as possible


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/eb3986eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/eb3986eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/eb3986eb

Branch: refs/heads/master
Commit: eb3986eb0bc1f8cb48cb2bf3a9d15c7fcd5aa356
Parents: 5c1fe9c
Author: Suresh Subbiah <sureshs@apache.org>
Authored: Wed Oct 5 04:11:52 2016 +0000
Committer: Suresh Subbiah <sureshs@apache.org>
Committed: Wed Oct 5 04:11:52 2016 +0000

----------------------------------------------------------------------
 core/sql/arkcmp/CmpContext.cpp          |  3 +-
 core/sql/arkcmp/CmpStatement.cpp        |  2 ++
 core/sql/arkcmp/cmpargs.cpp             |  2 +-
 core/sql/cli/Context.cpp                | 21 +++++++------
 core/sql/cli/Globals.cpp                | 17 +++++++----
 core/sql/common/BloomFilter.cpp         |  2 +-
 core/sql/common/ColIndList.h            |  4 +--
 core/sql/common/Collections.cpp         |  1 -
 core/sql/common/Collections.h           | 45 +++++++++++++++-------------
 core/sql/common/ComExeTrace.cpp         |  1 +
 core/sql/common/Ipc.h                   |  4 ++-
 core/sql/common/NAMemory.cpp            |  2 +-
 core/sql/common/NATestpoint.cpp         |  3 +-
 core/sql/common/NATraceList.h           |  2 +-
 core/sql/executor/ExHbaseAccess.cpp     |  1 +
 core/sql/executor/ExHbaseDDL.cpp        |  2 +-
 core/sql/exp/ExpLOB.h                   |  4 ++-
 core/sql/exp/ExpPCodeOptimizations.cpp  |  2 +-
 core/sql/exp/ExpPCodeOptsBulk.cpp       |  4 +--
 core/sql/exp/ExpPCodeOptsNativeExpr.cpp |  2 +-
 core/sql/exp/exp_tuple_desc.cpp         | 17 ++++++-----
 core/sql/export/ComDiags.cpp            |  4 +--
 core/sql/langman/LmRoutineJava.cpp      |  3 +-
 core/sql/langman/LmUtility.cpp          |  2 +-
 core/sql/optimizer/BindItemExpr.cpp     |  6 ++--
 core/sql/optimizer/BindRI.cpp           |  2 +-
 core/sql/optimizer/BindRelExpr.cpp      |  2 +-
 core/sql/optimizer/BindWA.h             |  2 +-
 core/sql/optimizer/ColStatDesc.cpp      |  6 ++--
 core/sql/optimizer/EncodedValue.cpp     |  3 +-
 core/sql/optimizer/HDFSHook.cpp         |  2 +-
 core/sql/optimizer/MJVIndexBuilder.cpp  | 12 ++++----
 core/sql/optimizer/MjvBuilder.cpp       |  2 +-
 core/sql/optimizer/MvRefreshBuilder.cpp |  4 +--
 core/sql/optimizer/NATable.h            |  9 +++++-
 core/sql/optimizer/NodeMap.cpp          |  2 +-
 core/sql/optimizer/NormRelExpr.cpp      |  7 ++---
 core/sql/optimizer/OptRange.cpp         |  4 +--
 core/sql/optimizer/RelExpr.cpp          | 23 ++++++++------
 core/sql/optimizer/Rule.cpp             |  4 +--
 core/sql/optimizer/ScanOptimizer.cpp    |  4 +--
 core/sql/optimizer/SearchKey.cpp        |  4 +--
 core/sql/optimizer/Stats.h              | 12 ++++----
 core/sql/optimizer/TableNameMap.h       |  3 +-
 core/sql/optimizer/TransRule.cpp        |  2 +-
 core/sql/parser/ElemDDLHbaseOptions.h   |  3 +-
 core/sql/runtimestats/ssmpipc.cpp       |  2 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp |  8 ++---
 core/sql/sqlcomp/PrivMgrDesc.h          |  8 ++---
 core/sql/sqlmsg/GetErrorMessage.cpp     |  2 +-
 core/sql/ustat/hs_parser.cpp            |  4 +--
 51 files changed, 163 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/arkcmp/CmpContext.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpContext.cpp b/core/sql/arkcmp/CmpContext.cpp
index 33da08b..f48d7d2 100644
--- a/core/sql/arkcmp/CmpContext.cpp
+++ b/core/sql/arkcmp/CmpContext.cpp
@@ -139,7 +139,8 @@ CmpContext::CmpContext(UInt32 f, CollHeap * h)
   optPCodeCache_(NULL),                       // just to be safe ...
   CDBList_(NULL),
   allControlCount_(0),
-  optSimulator_(NULL)
+  optSimulator_(NULL),
+  hosts_(h)
 {
   SetMode(isDynamicSQL() ? STMT_DYNAMIC : STMT_STATIC);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/arkcmp/CmpStatement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpStatement.cpp b/core/sql/arkcmp/CmpStatement.cpp
index 070a1a5..0f2a6f2 100644
--- a/core/sql/arkcmp/CmpStatement.cpp
+++ b/core/sql/arkcmp/CmpStatement.cpp
@@ -140,6 +140,7 @@ CmpStatement::error(Lng32 no, const char* s)
 CmpStatement::CmpStatement(CmpContext* context,
                            CollHeap* outHeap,
                            NAMemory::NAMemoryType memoryType)
+ : parserStmtLiteralList_(outHeap)
 {
   exceptionRaised_ = FALSE;
   reply_ = 0;
@@ -202,6 +203,7 @@ CmpStatement::CmpStatement(CmpContext* context,
 
   simpleFSOTaskMonitor_ = new (heap_) TaskMonitor();
   //simpleFSOMonPtr = simpleFSOTaskMonitor_;
+  parserStmtLiteralList_.setHeap(heap_);
 }
 
 CmpStatement::~CmpStatement()

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/arkcmp/cmpargs.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/cmpargs.cpp b/core/sql/arkcmp/cmpargs.cpp
index a39207a..6ebfa91 100644
--- a/core/sql/arkcmp/cmpargs.cpp
+++ b/core/sql/arkcmp/cmpargs.cpp
@@ -195,7 +195,7 @@ Cmdline_Args::Cmdline_Args()
     allocMethod_(IPC_ALLOC_DONT_CARE),
     socketArg_(0),
     portArg_(0),
-    settings_(),
+    settings_(NULL), // This NAArray goes on system heap. NULL for heap*
     noSeabaseDefTableRead_(FALSE)
 {}
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/cli/Context.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index 1833488..ef65ac5 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -178,11 +178,16 @@ ContextCli::ContextCli(CliGlobals *cliGlobals)
     dropInProgress_(FALSE),
     isEmbeddedArkcmpInitialized_(FALSE),
     embeddedArkcmpContext_(NULL),
-    ddlStmtsExecuted_(FALSE)
-   , numCliCalls_(0)
-   , jniErrorStr_(&exHeap_)
-   , hbaseClientJNI_(NULL)
-   , hiveClientJNI_(NULL)
+    ddlStmtsExecuted_(FALSE),
+    numCliCalls_(0),
+    jniErrorStr_(&exHeap_),
+    hbaseClientJNI_(NULL),
+    hiveClientJNI_(NULL),
+    arkcmpArray_(&exHeap_),
+    cmpContextInfo_(&exHeap_),
+    cmpContextInUse_(&exHeap_),
+    arkcmpInitFailed_(&exHeap_),
+    trustedRoutines_(&exHeap_)
 {
   exHeap_.setJmpBuf(cliGlobals->getJmpBuf());
   cliSemaphore_ = new (&exHeap_) CLISemaphore();
@@ -232,9 +237,6 @@ ContextCli::ContextCli(CliGlobals *cliGlobals)
   authToken_    = 0;
   authIDType_   = SQLAUTHID_TYPE_INVALID;
 
-  arkcmpArray_.setHeap(exCollHeap());
-  arkcmpInitFailed_.setHeap(exCollHeap());
-
   arkcmpArray_.insertAt(0,  new(exCollHeap()) ExSqlComp(0,
                                exCollHeap(),
                                cliGlobals,0,
@@ -301,9 +303,6 @@ ContextCli::ContextCli(CliGlobals *cliGlobals)
 
   hdfsHandleList_ = new(exCollHeap()) HashQueue(exCollHeap(), 50); // The hfsHandleList_ represents a list of distict hdfs Handles with unique hdfs port numbers and server names. Assume not more than 50 hdfsServers could be connected in the Trafodion setup.  These will get initialized the first time access is made to a particular hdfs server. This list gets cleaned up when the thread exits. 
   
-  // For CmpContext switch
-  cmpContextInfo_.setHeap(exCollHeap());
-  cmpContextInUse_.setHeap(exCollHeap());
 }  
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/cli/Globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Globals.cpp b/core/sql/cli/Globals.cpp
index cabdc29..5194ae9 100644
--- a/core/sql/cli/Globals.cpp
+++ b/core/sql/cli/Globals.cpp
@@ -107,15 +107,20 @@ CliGlobals::CliGlobals(NABoolean espProcess)
        priorityChanged_(FALSE),
        currRootTcb_(NULL),
        processStats_(NULL),
-       savedPriority_(148) // Set it to some valid priority to start with
+       savedPriority_(148), // Set it to some valid priority to start with
+       qualifyingVolsPerNode_(NULL),
+       cpuNumbers_(NULL),
+       capacities_(NULL),
+       freespaces_(NULL),
+       largestFragments_(NULL),
+       tidList_(NULL),
+       cliSemaphore_(NULL),
+       defaultContext_(NULL),
+       langManC_(NULL),
+       langManJava_(NULL)
 #ifdef SQ_PHANDLE_VERIFIER
        , myVerifier_(-1)
 #endif
-       , tidList_(NULL)
-       , cliSemaphore_(NULL)
-       , defaultContext_(NULL)
-       , langManC_(NULL)
-       , langManJava_(NULL)
 {
   globalsAreInitialized_ = FALSE;
   executorMemory_.setThreadSafe();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/BloomFilter.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/BloomFilter.cpp b/core/sql/common/BloomFilter.cpp
index 313678b..68e3f36 100644
--- a/core/sql/common/BloomFilter.cpp
+++ b/core/sql/common/BloomFilter.cpp
@@ -1148,7 +1148,7 @@ FastStatsCountingBloomFilter::FastStatsCountingBloomFilter(NAHeap* heap,
   overflowCountTable_(scbfHashFunc, 1000 /* initial # of elements */,
                       TRUE/*uniqueness enforced*/, heap),
   counters_(m_, (UInt32)bitsNeeded(maxNonOverflowFreq), heap_),
-  keys_(n/* initial # of elements*/, heap)
+  keys_(heap, n/* initial # of elements*/)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/ColIndList.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ColIndList.h b/core/sql/common/ColIndList.h
index 5e355d1..aaaaed3 100644
--- a/core/sql/common/ColIndList.h
+++ b/core/sql/common/ColIndList.h
@@ -46,8 +46,8 @@
 class ColIndList : public LIST(Lng32)
 {
 public:
-  ColIndList() : LIST(Lng32)() {}
-  ColIndList(LIST(Lng32) list) : LIST(Lng32)(list) {}
+ ColIndList() : LIST(Lng32)(NULL) {} // on C++ heap
+ ColIndList(LIST(Lng32) list) : LIST(Lng32)(list,NULL) {}
   virtual ~ColIndList() {}
   NABoolean isPrefixOf(const ColIndList& other) const;
   NABoolean isOrderedPrefixOf(const ColIndList& other) const;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/Collections.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/Collections.cpp b/core/sql/common/Collections.cpp
index 54460d8..04c953d 100644
--- a/core/sql/common/Collections.cpp
+++ b/core/sql/common/Collections.cpp
@@ -1506,7 +1506,6 @@ NAHashDictionaryIterator<K,V>::NAHashDictionaryIterator (const NAHashDictionary<
                                                          const V* value)
      : iterator_(dict.heap_)
 {
-  NAHashBucket<K,V> iteratorTemp ; 
   if (key)
     (*(dict.hashTable_))[dict.getHashCode(*key)]->getKeyValuePair(key,value,iterator_);
   else 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/Collections.h
----------------------------------------------------------------------
diff --git a/core/sql/common/Collections.h b/core/sql/common/Collections.h
index d3fac06..ac482ba 100644
--- a/core/sql/common/Collections.h
+++ b/core/sql/common/Collections.h
@@ -1832,8 +1832,8 @@ template <class T> class NASet : public NACollection<T>
 public:
 
   // default constructor
-  NASet(CollIndex initSize = 0) : NACollection<T>(initSize)
-  { invalidateCache(); }
+  /* NASet(CollIndex initSize = 0) : NACollection<T>(initSize)
+     { invalidateCache(); } */
 
   // constructor with user-defined heap
   NASet(CollHeap  *heap,
@@ -1841,7 +1841,7 @@ public:
   { invalidateCache(); }
 
   // copy ctor
-  NASet(const SET(T) &other, CollHeap * heap=0) : NACollection<T>(other, heap)
+  NASet(const SET(T) &other, CollHeap * heap) : NACollection<T>(other, heap)
   { invalidateCache(); }
 
   // virtual destructor
@@ -1959,8 +1959,8 @@ template <class T> class NAList : public NACollection<T>
 public:
 
   // default constructor
-  NAList(CollIndex initLen = 0) : NACollection<T>(initLen) 
-  { first_ = last_ = userIndexCache_ = arrayIndexCache_ = NULL_COLL_INDEX; }
+  /*NAList(CollIndex initLen = 0) : NACollection<T>(initLen) 
+    { first_ = last_ = userIndexCache_ = arrayIndexCache_ = NULL_COLL_INDEX; }*/
 
   // constructor with user-defined heap
   NAList(CollHeap * heap,
@@ -1968,7 +1968,7 @@ public:
   { first_ = last_ = userIndexCache_ = arrayIndexCache_ = NULL_COLL_INDEX; }
 
   // copy ctor
-  NAList(const NAList<T> &other, CollHeap * heap=0) : NACollection<T>(other, heap)
+  NAList(const NAList<T> &other, CollHeap * heap) : NACollection<T>(other, heap)
   {
     first_ = other.first_;
     last_ = other.last_;
@@ -2217,15 +2217,15 @@ template <class T> class NAArray : public NACollection<T>
 public :
 
   // default constructor
-  NAArray(CollIndex initialElements = 0) : 
-       NACollection<T>(initialElements) {}
+  //NAArray(CollIndex initialElements = 0) : 
+  //NACollection<T>(initialElements) {}
 
   // constructor with user-defined heap
   NAArray(CollHeap *heap, CollIndex initialElements = 0) : 
        NACollection<T>(heap,initialElements) {}
 
   // copy ctor
-  NAArray(const NAArray & other, CollHeap * heap=0) : 
+  NAArray(const NAArray & other, CollHeap * heap) : 
        NACollection<T>(other, heap) {}
   
   // Resize the array to a new size(return new size)
@@ -2285,10 +2285,10 @@ template <class T> class NASubArray : public NASubCollection<T>
 
 public:
 
-  NASubArray(NAArray<T> *superset = NULL, CollHeap* heap=0) : 
+  NASubArray(NAArray<T> *superset, CollHeap* heap) : 
        NASubCollection<T>(superset, heap) {}
 
-  NASubArray(const NASubArray<T> &other, CollHeap * heap=0) : 
+  NASubArray(const NASubArray<T> &other, CollHeap * heap) : 
        NASubCollection<T>(other, heap) {}
 
   virtual ~NASubArray();
@@ -2358,10 +2358,10 @@ template <class T> class NASimpleArray : private NAArray<T>
 {
 
 public:
-  NASimpleArray (CollHeap * h=0) : NAArray<T>(h) {}
+  NASimpleArray (CollHeap * h) : NAArray<T>(h) {}
 
   // copy ctor
-  NASimpleArray (const NASimpleArray & orig, CollHeap * h=0) 
+  NASimpleArray (const NASimpleArray & orig, CollHeap * h) 
        : NAArray<T>(orig, h) {} 
 
   void clearAndDestroy()
@@ -2389,10 +2389,15 @@ public:
   
   // operator s new and delete get inherited from private base class,
   // make them publicly available by the following inline functions
-  static inline void * operator new(size_t size, CollHeap* h=0)
+  static inline void * operator new(size_t size, CollHeap* h)
                                 { return NAArray<T>::operator new(size, h); }
   static inline void operator delete(void *buffer)
                                   { NAArray<T>::operator delete(buffer); }
+
+  inline void setHeap(CollHeap *heap)
+   {
+     NAArray<T>::setHeap(heap);
+   }
 }; // NASimpleArray
 
 // ----------------------------------------------------------------------
@@ -2506,10 +2511,10 @@ public:
   // --------------------------------------------------------------------
   // Constructor function
   // --------------------------------------------------------------------
-  NAHashBucket(CollHeap * heap=0): bucket_(heap), heap_(heap) {}
+  NAHashBucket(CollHeap * heap): bucket_(heap), heap_(heap) {}
  
   // copy ctor
-  NAHashBucket(const NAHashBucket<K,V>& other, CollHeap * heap=0);
+  NAHashBucket(const NAHashBucket<K,V>& other, CollHeap * heap);
   
   // --------------------------------------------------------------------
   // Destructor function
@@ -2618,7 +2623,7 @@ friend class NAHashDictionaryIterator<K,V>;
 		   CollHeap * heap=0 /* where to allocate memory */ );
 
   // copy ctor
-  NAHashDictionary(const NAHashDictionary<K,V>& other, CollHeap * heap=0);
+  NAHashDictionary(const NAHashDictionary<K,V>& other, CollHeap * heap);
   
   // --------------------------------------------------------------------
   // Destructor function
@@ -2818,7 +2823,7 @@ public:
 
   // copy ctor
   NAHashDictionaryIterator<K,V> (const NAHashDictionaryIterator<K,V> & other,
-                                 CollHeap * heap=0) ; 
+                                 CollHeap * heap) ; 
 
   // dtor
   ~NAHashDictionaryIterator<K,V>() ; 
@@ -2913,13 +2918,13 @@ public:
   // --------------------------------------------------------------------
   NAKeyLookup(short initSize, 
               NAKeyLookupEnums::KeyProvenance keyProvenance,
-              CollHeap * heap=0 ) :
+              CollHeap * heap) :
        NAHashDictionary<K,V>(&hashKey, initSize, TRUE,heap),
        keyProvenance_(keyProvenance)
   {}
 
   // copy ctor
-  NAKeyLookup (const NAKeyLookup & nakl, CollHeap * heap=0 ) :
+  NAKeyLookup (const NAKeyLookup & nakl, CollHeap * heap) :
        NAHashDictionary<K,V>(nakl, heap),
        keyProvenance_(nakl.keyProvenance_)
   {}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/ComExeTrace.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/ComExeTrace.cpp b/core/sql/common/ComExeTrace.cpp
index 60c0702..63b6221 100644
--- a/core/sql/common/ComExeTrace.cpp
+++ b/core/sql/common/ComExeTrace.cpp
@@ -83,6 +83,7 @@ ExeTrace::getTitleLineWidth()
 
 
 ExeTraceInfo::ExeTraceInfo()
+  : exeTraces_(NULL) // on C++ heap
 {
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/Ipc.h
----------------------------------------------------------------------
diff --git a/core/sql/common/Ipc.h b/core/sql/common/Ipc.h
index 657d086..6c59ba4 100644
--- a/core/sql/common/Ipc.h
+++ b/core/sql/common/Ipc.h
@@ -572,7 +572,9 @@ public:
 
   static const char *getConnectionStateString(IpcConnectionState s);
 
-  IpcConnection() : fileNumForIOCompletion_(InvalidGuaFileNumber) {}
+ IpcConnection() 
+   : fileNumForIOCompletion_(InvalidGuaFileNumber),
+    recvStreams_(NULL) {} // recvStream on C++ heap
 
   virtual ~IpcConnection();
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/NAMemory.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.cpp b/core/sql/common/NAMemory.cpp
index 17d300e..cca6cbf 100644
--- a/core/sql/common/NAMemory.cpp
+++ b/core/sql/common/NAMemory.cpp
@@ -4300,7 +4300,7 @@ NAHeap::setAllocTrace()
       traceEnvChecked = true;
     }
   if (TraceAllocSize != 0 && memcmp(name_, "Process Stats Heap", 18))
-    la_ = new LIST(TrafAddrStack *);
+    la_ = new LIST(TrafAddrStack *)(NULL); // on C++ heap
   else
     la_ = NULL;
 }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/NATestpoint.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NATestpoint.cpp b/core/sql/common/NATestpoint.cpp
index b24e8d4..323adef 100644
--- a/core/sql/common/NATestpoint.cpp
+++ b/core/sql/common/NATestpoint.cpp
@@ -323,7 +323,8 @@ CNATestPoint::Wait ( Lng32 delayTime_in_millisecs )
 // Constructor
 // ---------------------------------------------------------------------
 CNATestPointList::CNATestPointList ( EOwnership ownership) 
-    : m_ownership (ownership)
+  : LIST(CNATestPoint*)(NULL), 
+    m_ownership (ownership)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/common/NATraceList.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NATraceList.h b/core/sql/common/NATraceList.h
index c78800e..5987654 100644
--- a/core/sql/common/NATraceList.h
+++ b/core/sql/common/NATraceList.h
@@ -46,7 +46,7 @@ class NATraceList : public LIST(NAString)
 {
 public:
 
-  NATraceList(){}
+ NATraceList(): LIST(NAString)(NULL) {} // on C++ heap
    ~NATraceList(){} 
 
   inline NATraceList & operator = (const NATraceList &rhs)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/executor/ExHbaseAccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseAccess.cpp b/core/sql/executor/ExHbaseAccess.cpp
index 37f55ea..0e5642a 100644
--- a/core/sql/executor/ExHbaseAccess.cpp
+++ b/core/sql/executor/ExHbaseAccess.cpp
@@ -233,6 +233,7 @@ ExHbaseAccessTcb::ExHbaseAccessTcb(
   , rowIds_(glob ? glob->getDefaultHeap() : NULL)
   , columns_(glob ? glob->getDefaultHeap() : NULL)
   , deletedColumns_(glob ? glob->getDefaultHeap() : NULL)
+  , hnl_(glob ? glob->getDefaultHeap() : NULL)
   , hbaseFilterColumns_(glob ? glob->getDefaultHeap() : NULL)
   , hbaseFilterOps_(glob ? glob->getDefaultHeap() : NULL)
   , hbaseFilterValues_(glob ? glob->getDefaultHeap() : NULL)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/executor/ExHbaseDDL.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseDDL.cpp b/core/sql/executor/ExHbaseDDL.cpp
index 713c3e6..4f927eb 100644
--- a/core/sql/executor/ExHbaseDDL.cpp
+++ b/core/sql/executor/ExHbaseDDL.cpp
@@ -86,7 +86,7 @@ ExWorkProcRetcode ExHbaseAccessDDLTcb::work()
 
 	    Queue * cfnl = hbaseAccessTdb().getColFamNameList();
 	    cfnl->position();
-	    HBASE_NAMELIST colFamList;
+	    HBASE_NAMELIST colFamList(getHeap());
 	    HbaseStr colFam;
 	    while(NOT cfnl->atEnd())
 	      {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/exp/ExpLOB.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.h b/core/sql/exp/ExpLOB.h
index 53a176b..822a694 100644
--- a/core/sql/exp/ExpLOB.h
+++ b/core/sql/exp/ExpLOB.h
@@ -74,6 +74,7 @@ class LobLoadInfo
  public:
   LobLoadInfo(CollHeap * heap)
     : heap_(heap)
+    , lobEntryList_(heap)
   {};
   ~LobLoadInfo(){}
   void setLobLoadEntries(Lng32 num)
@@ -123,7 +124,8 @@ class LOBglobals : public NABasicObject {
  public:
  LOBglobals(CollHeap * heap) : heap_(heap),
     lobAccessGlobals_(NULL),
-    xnId_(-1)
+    xnId_(-1),
+    lobOperInProgressList_(heap)
       {
 	lobLoadInfo_ = new(heap) LobLoadInfo(heap);
       };

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/exp/ExpPCodeOptimizations.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpPCodeOptimizations.cpp b/core/sql/exp/ExpPCodeOptimizations.cpp
index cc58feb..26be30c 100644
--- a/core/sql/exp/ExpPCodeOptimizations.cpp
+++ b/core/sql/exp/ExpPCodeOptimizations.cpp
@@ -4414,7 +4414,7 @@ void PCodeCfg::setupForCSE(INSTLIST** cseList)
 
   // Set up cseList to keep track of like PCODE instructions
   for (i=0; i < MAX_NUM_PCODE_INSTS; i++)
-    cseList[i] = new(heap_) INSTLIST;
+    cseList[i] = new(heap_) INSTLIST(heap_);
 
   FOREACH_BLOCK_REV_DFO(block, firstInst, lastInst, index) {
     FOREACH_INST_IN_BLOCK(block, inst) {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/exp/ExpPCodeOptsBulk.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpPCodeOptsBulk.cpp b/core/sql/exp/ExpPCodeOptsBulk.cpp
index 61f9954..853a2d5 100644
--- a/core/sql/exp/ExpPCodeOptsBulk.cpp
+++ b/core/sql/exp/ExpPCodeOptsBulk.cpp
@@ -129,7 +129,7 @@ void PCodeCfg::bulkHashComb()
         newInst->code[3] = inst->code[2];
 
         // Create one list with all the source operands
-        OPLIST list;
+        OPLIST list(heap_);
 
         // If the source inst found is not null (i.e. HASH or HASHCOMB_BULK)
         // then include its operands.  Otherwise, we can't hash the source, but
@@ -177,7 +177,7 @@ void PCodeCfg::bulkHashComb()
       if (inst->getOpcode() == PCIT::HASHCOMB_BULK_MBIN32U) {
 
         // Create one list with all the source operands
-        OPLIST list;
+        OPLIST list(heap_);
 
         list.insert(inst->getROps());
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/exp/ExpPCodeOptsNativeExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpPCodeOptsNativeExpr.cpp b/core/sql/exp/ExpPCodeOptsNativeExpr.cpp
index 515c831..4cf07af 100755
--- a/core/sql/exp/ExpPCodeOptsNativeExpr.cpp
+++ b/core/sql/exp/ExpPCodeOptsNativeExpr.cpp
@@ -5768,7 +5768,7 @@ void PCodeCfg::layoutNativeCode()
 
   PCodeBinary* pCode = expr_->getPCodeBinary();
 
-  NExTempsList_ = new(heap_) NExTEMPSLIST();
+  NExTempsList_ = new(heap_) NExTEMPSLIST(heap_);
 
 
   // First see if this graph can be compiled natively

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/exp/exp_tuple_desc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_tuple_desc.cpp b/core/sql/exp/exp_tuple_desc.cpp
index 89d4cf1..c1399b0 100644
--- a/core/sql/exp/exp_tuple_desc.cpp
+++ b/core/sql/exp/exp_tuple_desc.cpp
@@ -154,11 +154,12 @@ static Int16 orderFixedFieldsByAlignment( Attributes    ** attrs,
   Int16  rc = 0;
 
   Attributes *attr;
-  NAList<UInt32> align8(4);
-  NAList<UInt32> align4(10);
-  NAList<UInt32> align2(10);
-  NAList<UInt32> align1(4);
-  NAList<UInt32> addedCols(4);
+  NAList<UInt32> align8(NULL,4);
+  NAList<UInt32> align4(NULL,10);
+  NAList<UInt32> align2(NULL,10);
+  NAList<UInt32> align1(NULL,4);
+  NAList<UInt32> addedCols(NULL,4); // on C++ heap, wil get dellocated when
+                                    // we return
 
   UInt32 fieldIdx = 0;
   UInt32 numFixed = fixedFields->entries();
@@ -619,9 +620,9 @@ Int16 ExpTupleDesc::computeOffsets(UInt32 num_attrs,        /* IN  */
         // GU attributes are materialized view columns that are projected out
         // during an update.
         // Variable length fields get their VOA offset set here too.
-	NAList<UInt32> fixedColumns(10);
-	NAList<UInt32> varFields(10);
-	NAList<UInt32> guFields(3);
+	NAList<UInt32> fixedColumns(NULL,10);
+	NAList<UInt32> varFields(NULL,10);
+	NAList<UInt32> guFields(NULL,3);
 
         NAList<UInt32> *fixedFields = &fixedColumns;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/export/ComDiags.cpp
----------------------------------------------------------------------
diff --git a/core/sql/export/ComDiags.cpp b/core/sql/export/ComDiags.cpp
index fe604fa..77fd60a 100644
--- a/core/sql/export/ComDiags.cpp
+++ b/core/sql/export/ComDiags.cpp
@@ -1671,8 +1671,8 @@ ComDiagsArea::ComDiagsArea (CollHeap* ptr): IpcMessageObj(IPC_SQL_DIAG_AREA,0),
 
 ComDiagsArea::ComDiagsArea () :             IpcMessageObj(IPC_SQL_DIAG_AREA,0),
                                             collHeapPtr_(NULL),
-                                            errors_(),
-                                            warnings_(),
+                                            errors_(NULL),
+                                            warnings_(NULL),
                                             newCondition_(NULL),
 					    lengthLimit_(30),
                                             areMore_(ComCondition::NO_MORE),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/langman/LmRoutineJava.cpp
----------------------------------------------------------------------
diff --git a/core/sql/langman/LmRoutineJava.cpp b/core/sql/langman/LmRoutineJava.cpp
index 232c4b8..eb91817 100644
--- a/core/sql/langman/LmRoutineJava.cpp
+++ b/core/sql/langman/LmRoutineJava.cpp
@@ -79,7 +79,8 @@ LmRoutineJava::LmRoutineJava(
 	      parameters, lm),
     javaParams_(NULL),
     retType_(LmJavaType::JT_NONE),
-    defaultCatSch_(FALSE)
+    defaultCatSch_(FALSE),
+    connectionList_(collHeap())
 {
   JNIEnv *jni = (JNIEnv*)getLM()->jniEnv_;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/langman/LmUtility.cpp
----------------------------------------------------------------------
diff --git a/core/sql/langman/LmUtility.cpp b/core/sql/langman/LmUtility.cpp
index 987d199..e4db61c 100644
--- a/core/sql/langman/LmUtility.cpp
+++ b/core/sql/langman/LmUtility.cpp
@@ -108,7 +108,7 @@ void lmUtilitySetTransactionAttrs(Int32 transAttrs) { transactionAttrs = transAt
 // the retrieved connection references when they are no longer needed.
 // 
 
-NAList<jobject> lmUtilityConnList;
+NAList<jobject> lmUtilityConnList(NULL);
 
 
 // If there are any Java connection objects present in 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/BindItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp
index 156e523..af6a46d 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -4663,8 +4663,8 @@ Int32 ItemExpr::convertToValueIdSet(ValueIdSet &vs,
   // * a "state" value that tells us where we are in the convertToValueIdSet()
   //   code for the ItemExpr node that we are currently working on
   //
-  ARRAY( ItemExpr * ) IEarray(10) ; //Initially 10 elements (no particular reason to choose 10)
-  ARRAY( Int16 )      state(10)   ; //These ARRAYs will grow automatically as needed.)
+  ARRAY( ItemExpr * ) IEarray(HEAP, 10) ; //Initially 10 elements (no particular reason to choose 10)
+  ARRAY( Int16 )      state(HEAP, 10)   ; //These ARRAYs will grow automatically as needed.)
 
   Int32  currIdx    = 0           ;
   IEarray.insertAt( currIdx, this       ) ; //Initialize first array element
@@ -9743,7 +9743,7 @@ ItemExpr *UDFunction::bindNode(BindWA *bindWA)
     }
 
   // Save off a copy of the chilren array 
-  ARRAY(ExprValueId) copyOfChildren;
+  ARRAY(ExprValueId) copyOfChildren(HEAP);
   for (Int32 i=0; i< getArity(); i++)
     copyOfChildren.insertAt(i, child(i));
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/BindRI.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRI.cpp b/core/sql/optimizer/BindRI.cpp
index 7d9354c..9ff85b9 100644
--- a/core/sql/optimizer/BindRI.cpp
+++ b/core/sql/optimizer/BindRI.cpp
@@ -363,7 +363,7 @@ Int32 AbstractRIConstraintList::getRefConstraints(
 					const ValueIdSet &assigns,
 					RefConstraintList &resultList) const
 {
-  Constraint::ColSignature updateCols;
+  Constraint::ColSignature updateCols(HEAP);
   if (entries() && bindWA->getCurrentScope()->context()->inUpdate())
     Constraint::makeColSignature(assigns, updateCols);
   

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 8e1d4d8..8c51eeb 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -15730,7 +15730,7 @@ RelExpr *CallSP::bindNode(BindWA *bindWA)
   LIST (ItemExpr *) &bWA_HVorDPs = bindWA->getSpHVDPs();
   CollIndex numHVorDPs = bWA_HVorDPs.entries();
 
-  ARRAY(ItemExpr *) local_HVorDPs(numHVorDPs);
+  ARRAY(ItemExpr *) local_HVorDPs(HEAP, numHVorDPs);
   CollIndex idx, idx1, idx2;
 
   // Sort the ItemExpr in the order they appeared in the stmt

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/BindWA.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindWA.h b/core/sql/optimizer/BindWA.h
index 232c04b..6faf167 100644
--- a/core/sql/optimizer/BindWA.h
+++ b/core/sql/optimizer/BindWA.h
@@ -1998,7 +1998,7 @@ class HbaseColUsageInfo : public NABasicObject
   
   void insert(QualifiedName *tableName)
   {
-    NASet<NAString> * v = new(heap_) NASet<NAString>;
+    NASet<NAString> * v = new(heap_) NASet<NAString>(heap_);
     usageInfo_->insert(tableName, v);
   }
  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/ColStatDesc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ColStatDesc.cpp b/core/sql/optimizer/ColStatDesc.cpp
index 7b7ca2e..34e6ee2 100644
--- a/core/sql/optimizer/ColStatDesc.cpp
+++ b/core/sql/optimizer/ColStatDesc.cpp
@@ -10708,8 +10708,8 @@ MultiColumnUecList::getUecForMCJoin (
   CostScalar * uecEntry = NULL;
   MultiColumnUecListIterator iter( *this );
 
-  LIST(ValueIdSet) tableOnePossibles; // we'll iter over these
-  SET(ValueIdSet)  tableTwoPossibles; // we'll do lookups over these
+  LIST(ValueIdSet) tableOnePossibles(STMTHEAP); // we'll iter over these
+  SET(ValueIdSet)  tableTwoPossibles(STMTHEAP); // we'll do lookups over these
 
   for ( iter.getNext( keyEntry, uecEntry );
         keyEntry != NULL && uecEntry != NULL;
@@ -11418,7 +11418,7 @@ MultiColumnUecList::displayMissingStatsWarning(TableDesc * mostRefdTable,
   // This should not be very expensive, since column numbers are cached with the
   // column expression
 
-  CollIndexSet setOfColsWithMissingStats;
+  CollIndexSet setOfColsWithMissingStats(NULL,STMTHEAP);
 
   // define ValueId outside of for loop, to avoid c++ compiler error.
   ValueId col;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/EncodedValue.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/EncodedValue.cpp b/core/sql/optimizer/EncodedValue.cpp
index ffcab14..98ca526 100644
--- a/core/sql/optimizer/EncodedValue.cpp
+++ b/core/sql/optimizer/EncodedValue.cpp
@@ -276,7 +276,8 @@ void NormValue::display (FILE *f, const char * prefix, const char * suffix,
 // LCOV_EXCL_STOP
 
 NormValueList::NormValueList(const NormValueList & nvl, NAMemory *h)
-:heap_(h ? h : CmpCommon::statementHeap())
+  :NAArray<NormValue>(h ? h : CmpCommon::statementHeap(),nvl.entries()),
+  heap_(h ? h : CmpCommon::statementHeap())
 {
   for(CollIndex i=0; i<nvl.entries(); i++)
   {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/HDFSHook.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/HDFSHook.cpp b/core/sql/optimizer/HDFSHook.cpp
index fe183fb..701ea92 100644
--- a/core/sql/optimizer/HDFSHook.cpp
+++ b/core/sql/optimizer/HDFSHook.cpp
@@ -606,7 +606,7 @@ NABoolean HHDFSListPartitionStats::validateAndRefresh(hdfsFS fs, HHDFSDiags &dia
   // assume we get the files sorted by file name
   int numFiles = 0;
   Int32 lastBucketNum = -1;
-  ARRAY(Int32) fileNumInBucket(getLastValidBucketIndx()+1);
+  ARRAY(Int32) fileNumInBucket(HEAP, getLastValidBucketIndx()+1);
   HHDFSBucketStats *bucketStats = NULL;
 
   for (CollIndex i=0; i<=getLastValidBucketIndx(); i++)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/MJVIndexBuilder.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/MJVIndexBuilder.cpp b/core/sql/optimizer/MJVIndexBuilder.cpp
index 9b913e5..8679b38 100644
--- a/core/sql/optimizer/MJVIndexBuilder.cpp
+++ b/core/sql/optimizer/MJVIndexBuilder.cpp
@@ -260,7 +260,7 @@ ColIndSetBucketVector::insert (ColIndSet& newSet)
       
       for (size_t j = oldArrSize; j < newArrSize; j++) 
       {
-	empty = new (getHeapPtr()) ColIndSetBucket(j, getHeapPtr());
+	empty = new (getHeapPtr()) ColIndSetBucket(getHeapPtr(),j);
 	insertAt(j, empty);
       }
     }
@@ -329,9 +329,11 @@ ColIndSetMatrix::out()		const
 ColIndSetMatrix::ColIndSetMatrix( const ColIndSetBucketVector& src, 
 				  size_t size, 
 				  CollHeap *heap) :
-    ARRAY(EnumArray*)(size + 1, heap),
-    currIndex_(0) 	, 
-    lastIndex_(size+1) 
+  ARRAY(EnumArray*)(heap, size + 1),
+  currIndex_(0), 
+  lastIndex_(size+1),
+  setsList_(heap),
+  settledList_(heap)
 {
   size += 1;
   size_t i;
@@ -339,7 +341,7 @@ ColIndSetMatrix::ColIndSetMatrix( const ColIndSetBucketVector& src,
 
   for (i = 0; i < size; i++) 
   {
-    currEnumArray = new (heap) EnumArray(size, heap);
+    currEnumArray = new (heap) EnumArray(heap, size);
     CMPASSERT(NULL != currEnumArray);
     for (size_t j = 0; j < size; j++) {
       currEnumArray->insertAt(j, 0);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/MjvBuilder.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/MjvBuilder.cpp b/core/sql/optimizer/MjvBuilder.cpp
index f0d8159..96c394c 100644
--- a/core/sql/optimizer/MjvBuilder.cpp
+++ b/core/sql/optimizer/MjvBuilder.cpp
@@ -291,7 +291,7 @@ void MjvBuilder::setupBindContext(RelRoot *topNode,
 SET(MVColumnInfo*) MjvBuilder::collectAllAffectedColumns(const IntegerList *updatedCols,
 							 const QualifiedName &qualTableName ) const
 {
-  SET(MVColumnInfo*) affectedCols;
+  SET(MVColumnInfo*) affectedCols(STMTHEAP);
 
   // Finding out the list of columns in the MJV
   const MVColumns &mvCols = getMvInfo()->getMVColumns();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/MvRefreshBuilder.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/MvRefreshBuilder.cpp b/core/sql/optimizer/MvRefreshBuilder.cpp
index 1264488..d70d9eb 100644
--- a/core/sql/optimizer/MvRefreshBuilder.cpp
+++ b/core/sql/optimizer/MvRefreshBuilder.cpp
@@ -2709,7 +2709,7 @@ MultiDeltaRefreshMatrixRow::MultiDeltaRefreshMatrixRow(Int32 length,
   : sign_(SIGN_PLUS),
     currentLength_(length),
     maxLength_(maxLength),
-    tableScanTypes_(maxLength, heap),
+    tableScanTypes_(heap, maxLength),
     heap_(heap)
 {
   CMPASSERT(length <= maxLength);
@@ -2811,7 +2811,7 @@ MultiDeltaRefreshMatrix::MultiDeltaRefreshMatrix(Int32	        maxNumOfRows,
     numOfRowsForThisPhase_(0),
     tableIndexMapping_(heap),
     heap_(heap),
-    theMatrix_(maxNumOfRows, heap),
+    theMatrix_(heap, maxNumOfRows),
     TooManyDeltasError_(FALSE),
     isDuplicatesOptimized_(joinGraph->isInsertOnlyRefresh())
 {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/NATable.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NATable.h b/core/sql/optimizer/NATable.h
index 56556eb..afe3f6d 100644
--- a/core/sql/optimizer/NATable.h
+++ b/core/sql/optimizer/NATable.h
@@ -1245,7 +1245,14 @@ public:
   {}
 
   NATableDB (const NATableDB & orig, NAMemory * h) :
-       NAKeyLookup<ExtendedQualName,NATable> (orig, h)
+    NAKeyLookup<ExtendedQualName,NATable> (orig, h),
+    heap_(h),
+    statementTableList_(h),
+    statementCachedTableList_(h),
+    cachedTableList_(h),
+    tablesToDeleteAfterStatement_(h),
+    nonCacheableTableIdents_(h),
+    nonCacheableTableList_(h)
   {}
 
   NAHeap *getHeap() { return (NAHeap *)heap_; }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/NodeMap.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NodeMap.cpp b/core/sql/optimizer/NodeMap.cpp
index d609fb6..1c4d5ee 100644
--- a/core/sql/optimizer/NodeMap.cpp
+++ b/core/sql/optimizer/NodeMap.cpp
@@ -2743,7 +2743,7 @@ Int32 NodeMap::getNumberOfUniqueNodes() const
      }
   }
         
-  NAArray<Int32> na(maxNodeNum+1); // 0-based
+  NAArray<Int32> na(HEAP, maxNodeNum+1); // 0-based
 
   for (Int32 i=0; i<maxNodeNum+1; i++ ) 
      na.insertAt(i, 0);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/NormRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NormRelExpr.cpp b/core/sql/optimizer/NormRelExpr.cpp
index 4cdf154..ad90c09 100644
--- a/core/sql/optimizer/NormRelExpr.cpp
+++ b/core/sql/optimizer/NormRelExpr.cpp
@@ -582,9 +582,9 @@ ItemExpr * Scan::applyAssociativityAndCommutativity(
   //   fashion because the code does not assign to 'newRightNode' until *after*
   //   all recursion is finished.
   //
-  ARRAY( ItemExpr * ) IEarray(10) ; //Initially 10 elements (no particular reason to choose 10)
-  ARRAY( Int16 )      state(10)   ; //These ARRAYs will grow automatically as needed.)
-  ARRAY( ItemExpr *) leftNodeArray(10, heap);
+  ARRAY( ItemExpr * ) IEarray(heap, 10) ; //Initially 10 elements (no particular reason to choose 10)
+  ARRAY( Int16 )      state(heap, 10)   ; //These ARRAYs will grow automatically as needed.)
+  ARRAY( ItemExpr *) leftNodeArray(heap, 10);
 
   Int32   currIdx = 0;
   IEarray.insertAt( currIdx, origPtrToOldTree );
@@ -1142,7 +1142,6 @@ NABoolean RelExpr::getMoreOutputsIfPossible(ValueIdSet& outputsNeeded)
       maxOutputs,
       outputsNeeded);
       child(i)->getGroupAttr()->addCharacteristicOutputs(outputsToAdd);
-
      // child(i).getGroupAttr()->computeCharacteristicIO
 //	                                            (emptySet,  // no additional inputs
   //                                                   outputsNeeded);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/OptRange.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/OptRange.cpp b/core/sql/optimizer/OptRange.cpp
index c5f1610..179acf4 100644
--- a/core/sql/optimizer/OptRange.cpp
+++ b/core/sql/optimizer/OptRange.cpp
@@ -950,8 +950,8 @@ NABoolean OptRangeSpec::buildRange(ItemExpr* origPredExpr)
   // that tells us where we are in the buildRange() code for the ItemExpr
   // node that we are currently working on.
   //
-  ARRAY( ItemExpr * ) IEarray(10) ; //Initially 10 elements (no particular reason to choose 10)
-  ARRAY( Int16 )      state(10)   ; //These ARRAYs will grow automatically as needed.)
+  ARRAY( ItemExpr * ) IEarray(mvqrHeap_, 10) ; //Initially 10 elements (no particular reason to choose 10)
+  ARRAY( Int16 )      state(mvqrHeap_, 10)   ; //These ARRAYs will grow automatically as needed.)
 
   Int32 currIdx     = 0 ;
   IEarray.insertAt( currIdx, origPredExpr ) ; //Initialize 1st element in the ARRAYs

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/RelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExpr.cpp b/core/sql/optimizer/RelExpr.cpp
index a6d00fe..8349ced 100644
--- a/core/sql/optimizer/RelExpr.cpp
+++ b/core/sql/optimizer/RelExpr.cpp
@@ -10060,10 +10060,12 @@ HbaseAccess::HbaseAccess(CorrName &corrName,
 			 OperatorTypeEnum otype,
 			 CollHeap *oHeap)
   : FileScan(corrName, NULL, NULL, otype, oHeap),
-    listOfSearchKeys_(oHeap)
+    listOfSearchKeys_(oHeap),
+    snpType_(SNP_NONE),
+    retHbaseColRefSet_(oHeap),
+    opList_(oHeap)
 {
   accessType_ = SELECT_;
-  
   uniqueHbaseOper_ = FALSE;
   uniqueRowsetHbaseOper_ = FALSE;
 }
@@ -10087,11 +10089,12 @@ HbaseAccess::HbaseAccess(CorrName &corrName,
              generatedCCPreds,
              otype),
     listOfSearchKeys_(oHeap),
-    snpType_(SNP_NONE)
+    snpType_(SNP_NONE),
+    retHbaseColRefSet_(oHeap),
+    opList_(oHeap)
 {
   accessType_ = SELECT_;
   //setTableDesc(tableDesc);
-
   uniqueHbaseOper_ = FALSE;
   uniqueRowsetHbaseOper_ = FALSE;
 }
@@ -10103,10 +10106,11 @@ HbaseAccess::HbaseAccess(CorrName &corrName,
     isRW_(isRW),
     isCW_(isCW),
     listOfSearchKeys_(oHeap),
-    snpType_(SNP_NONE)
+    snpType_(SNP_NONE),
+    retHbaseColRefSet_(oHeap),
+    opList_(oHeap)
 {
   accessType_ = SELECT_;
-
   uniqueHbaseOper_ = FALSE;
   uniqueRowsetHbaseOper_ = FALSE;
 }
@@ -10115,10 +10119,11 @@ HbaseAccess::HbaseAccess( OperatorTypeEnum otype,
 			  CollHeap *oHeap)
   : FileScan(CorrName(), NULL, NULL, otype, oHeap),
     listOfSearchKeys_(oHeap),
-    snpType_(SNP_NONE)
+    snpType_(SNP_NONE),
+    retHbaseColRefSet_(oHeap),
+    opList_(oHeap)
 {
   accessType_ = SELECT_;
-
   uniqueHbaseOper_ = FALSE;
   uniqueRowsetHbaseOper_ = FALSE;
 }
@@ -15342,7 +15347,7 @@ NABoolean Join::childNodeContainMultiColumnSkew(
    // A list of valueIdSets, each valueIdSet element contains a set of 
    // columns from the join predicates. Each set has all columns from the
    // same table participating in the join predicates.
-   ARRAY(ValueIdSet) mcArray(joinPreds.entries());
+   ARRAY(ValueIdSet) mcArray(CmpCommon::statementHeap(), joinPreds.entries());
 
    Int32 skews = 0, leastSkewList = 0;
    EncodedValue mostFreqVal;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/Rule.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/Rule.cpp b/core/sql/optimizer/Rule.cpp
index c9b5723..212a484 100644
--- a/core/sql/optimizer/Rule.cpp
+++ b/core/sql/optimizer/Rule.cpp
@@ -259,8 +259,8 @@ void Rule::prepare()
 {
   // an array to hold pointers for cuts of the pattern, ordered by index
   // (most rules should get by with 4 cuts and 4 wildcards)
-  ARRAY(CutOp *) cuts(4);
-  ARRAY(WildCardOp *) wildcards(4);
+  ARRAY(CutOp *) cuts(HEAP, 4);
+  ARRAY(WildCardOp *) wildcards(HEAP, 4);
 
   // fill the "cuts" array
   if (pattern_)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/ScanOptimizer.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ScanOptimizer.cpp b/core/sql/optimizer/ScanOptimizer.cpp
index d5dfdbc..c7b024b 100644
--- a/core/sql/optimizer/ScanOptimizer.cpp
+++ b/core/sql/optimizer/ScanOptimizer.cpp
@@ -5500,8 +5500,8 @@ NABoolean FileScanOptimizer::isMDAMFeasibleForHBase(const IndexDesc* idesc, Valu
    }
 
 
-   ARRAY(Int32) uecsByKeyColumns;
-   ARRAY(Int32) rangesByKeyColumns;
+   ARRAY(Int32) uecsByKeyColumns(HEAP);
+   ARRAY(Int32) rangesByKeyColumns(HEAP);
  
    NABoolean possiblyUseMdam = FALSE;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/SearchKey.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/SearchKey.cpp b/core/sql/optimizer/SearchKey.cpp
index 3902394..3c98146 100644
--- a/core/sql/optimizer/SearchKey.cpp
+++ b/core/sql/optimizer/SearchKey.cpp
@@ -2807,8 +2807,8 @@ void HbaseSearchKey::makeHBaseSearchKeys(
 {
   // Range Specs for key columns, ordered by key position, plus the
   // normalized item expressions generated from the RangeSpecs
-  ARRAY(ItemExpr *) rangeSpecsForKeyCols;
-  ARRAY(ItemExprList *) rangeBackbonesForKeyCols;
+  ARRAY(ItemExpr *) rangeSpecsForKeyCols(HEAP);
+  ARRAY(ItemExprList *) rangeBackbonesForKeyCols(HEAP);
   ValueIdSet tempExternalInputs; // don't use non-consts as inputs
 
   producedKeys.clear();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/Stats.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/Stats.h b/core/sql/optimizer/Stats.h
index faa8bc7..4d3d5bd 100644
--- a/core/sql/optimizer/Stats.h
+++ b/core/sql/optimizer/Stats.h
@@ -233,9 +233,7 @@ class MCSkewedValueList : public NAList<MCSkewedValue *>
 {
 public:
   // constructor 
-  MCSkewedValueList() {};
-
-  MCSkewedValueList(NAMemory *h)
+  MCSkewedValueList(NAMemory *h=0)
     : NAList<MCSkewedValue *>(h),heap_(h) {};
 
   MCSkewedValueList(const MCSkewedValueList & mcsvl, NAMemory *h=0);
@@ -2218,10 +2216,10 @@ class StatsList : public SHPTR_LIST(ColStatsSharedPtr)
 public:
   StatsList(NAMemory* h,CollIndex initLen =0)
     : heap_(h),
-	  SHPTR_LIST(ColStatsSharedPtr) (h,initLen),
-      groupUecColumns_(h),
-	  groupUecValues_(h),
-	  groupMCSkewedValueLists_(h)
+    SHPTR_LIST(ColStatsSharedPtr) (h,initLen),
+    groupUecColumns_(h),
+    groupUecValues_(h),
+    groupMCSkewedValueLists_(h)
   {}
 
   // ---------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/TableNameMap.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/TableNameMap.h b/core/sql/optimizer/TableNameMap.h
index b27c46a..ea4e035 100644
--- a/core/sql/optimizer/TableNameMap.h
+++ b/core/sql/optimizer/TableNameMap.h
@@ -64,7 +64,8 @@ public:
   TableNameMap(const CorrName& tableName,
                ColumnDescList *columnList,
                CollHeap * h=0)
-  : tableName_(tableName,h), columnList_(columnList) {}
+    : tableName_(tableName,h), 
+    columnList_(columnList), hbaseColNameSet_(h){}
 
   // copy ctor
   TableNameMap (const TableNameMap &, CollHeap * h=0) ; // not written

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/optimizer/TransRule.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/TransRule.cpp b/core/sql/optimizer/TransRule.cpp
index 356e44a..b0acd75 100644
--- a/core/sql/optimizer/TransRule.cpp
+++ b/core/sql/optimizer/TransRule.cpp
@@ -1757,7 +1757,7 @@ RelExpr * OrOptimizationRule::nextSubstitute(
 
   // a sparse array that can be used to look up which index we have selected
   // for predicates on a particular column (identified by column number)
-  ARRAY(CollIndex)    indexInfoByColNum;
+  ARRAY(CollIndex)    indexInfoByColNum(CmpCommon::statementHeap());
 
   // a sparse array that stores the associated disjuncts for each index,
   // arranged by index number in the scan node

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/parser/ElemDDLHbaseOptions.h
----------------------------------------------------------------------
diff --git a/core/sql/parser/ElemDDLHbaseOptions.h b/core/sql/parser/ElemDDLHbaseOptions.h
index ffd465c..435c78e 100644
--- a/core/sql/parser/ElemDDLHbaseOptions.h
+++ b/core/sql/parser/ElemDDLHbaseOptions.h
@@ -49,7 +49,8 @@ class ElemDDLHbaseOptions : public ElemDDLNode
 
   ElemDDLHbaseOptions(NAList<HbaseCreateOption*> * hbaseOptions,
 		      CollHeap * heap)
-   : ElemDDLNode(ELM_HBASE_OPTIONS_ELEM)
+    : ElemDDLNode(ELM_HBASE_OPTIONS_ELEM),
+    hbaseOptions_(heap)
     {
       for (CollIndex i = 0; i < hbaseOptions->entries(); i++)
 	{

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/runtimestats/ssmpipc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/runtimestats/ssmpipc.cpp b/core/sql/runtimestats/ssmpipc.cpp
index f05543f..7616076 100755
--- a/core/sql/runtimestats/ssmpipc.cpp
+++ b/core/sql/runtimestats/ssmpipc.cpp
@@ -448,7 +448,7 @@ ULng32 SsmpGlobals::deAllocateServer(char *nodeName, short nodeNameLen,  short c
 
 void SsmpGlobals::cleanupDeletedSscpServers()
 {
-  NAList<IpcServer *> notReadyToCleanup;
+  NAList<IpcServer *> notReadyToCleanup(heap_);
   IpcServer *sscp;
   while (deletedSscps_->getFirst(sscp))
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 0929f56..b5536f6 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -8153,7 +8153,7 @@ void CmpSeabaseDDL::alterSeabaseTableAddRIConstraint(
 
   NAString constrName;
   NABoolean isPkey = FALSE;
-  NAList<int> reorderList;
+  NAList<int> reorderList(HEAP);
   // Find a uniqueness constraint on the referenced table that matches
   // the referenced column list (not necessarily in the original order
   // of columns).  Also find out how to reorder the column lists to
@@ -8184,9 +8184,9 @@ void CmpSeabaseDDL::alterSeabaseTableAddRIConstraint(
 
       // re-order referencing and referenced key column lists to match
       // the order of the uniqueness constraint in the referenced table
-      NAArray<NAString> ringTempKeyColArray(numEntries);
-      NAArray<NAString> ringTempKeyColOrderArray(numEntries);
-      NAArray<NAString> refdTempKeyColArray(numEntries);
+      NAArray<NAString> ringTempKeyColArray(HEAP, numEntries);
+      NAArray<NAString> ringTempKeyColOrderArray(HEAP, numEntries);
+      NAArray<NAString> refdTempKeyColArray(HEAP, numEntries);
 
       // copy the lists into temp arrays in the correct order
       for (CollIndex i=0; i<numEntries; i++)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/sqlcomp/PrivMgrDesc.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/PrivMgrDesc.h b/core/sql/sqlcomp/PrivMgrDesc.h
index e0e2e11..e7038d4 100644
--- a/core/sql/sqlcomp/PrivMgrDesc.h
+++ b/core/sql/sqlcomp/PrivMgrDesc.h
@@ -381,7 +381,7 @@ class PrivMgrDesc
 public:
    PrivMgrDesc(const PrivMgrDesc&other)           // copy constructor
    : tableLevel_(other.tableLevel_),
-     columnLevel_(other.columnLevel_),
+    columnLevel_(other.columnLevel_, NULL),
      grantee_(other.grantee_)
    {}
 
@@ -389,7 +389,7 @@ public:
                const int32_t nbrCols = 0    // preset constructor
               )
    : tableLevel_(),
-     columnLevel_(),
+     columnLevel_(NULL),
      grantee_(grantee)
   {}
 
@@ -397,13 +397,13 @@ public:
    PrivMgrDesc(const PrivMgrDesc &privs,            // preset constructor
                const int32_t grantee)
    : tableLevel_(privs.tableLevel_),
-     columnLevel_(privs.columnLevel_),
+    columnLevel_(privs.columnLevel_, NULL),
      grantee_(privs.grantee_)
    {}
 
    PrivMgrDesc(void)
    : tableLevel_(),
-     columnLevel_(),
+     columnLevel_(NULL),
      grantee_(0)
    {}
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/sqlmsg/GetErrorMessage.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlmsg/GetErrorMessage.cpp b/core/sql/sqlmsg/GetErrorMessage.cpp
index 4955b44..7d85c38 100644
--- a/core/sql/sqlmsg/GetErrorMessage.cpp
+++ b/core/sql/sqlmsg/GetErrorMessage.cpp
@@ -135,7 +135,7 @@ private:
   NABoolean fabricatedSqlstate_;
 };
 
-static NAList<SqlstateInfo*> listOfSqlstates_;
+static NAList<SqlstateInfo*> listOfSqlstates_(NULL);
 static pthread_mutex_t       listOfSqlstates_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 SQLERRORS_LIB_FUNC 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/eb3986eb/core/sql/ustat/hs_parser.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_parser.cpp b/core/sql/ustat/hs_parser.cpp
index d96acc7..22a2b16 100644
--- a/core/sql/ustat/hs_parser.cpp
+++ b/core/sql/ustat/hs_parser.cpp
@@ -934,7 +934,7 @@ Lng32 AddKeyGroups()
 
         while (numKeys >= minMCGroupSz)  // Create only MC groups not single cols
           {
-            HSColSet colSet;
+            HSColSet colSet(STMTHEAP);
 
             autoGroup = "(";
             for (j = 0; j < numKeys; j++)
@@ -1010,7 +1010,7 @@ Lng32 AddKeyGroups()
               minMCGroupSz = numKeys - maxMCGroups + 1;
             while (numKeys >= minMCGroupSz)  // MinMCGroupSz is greater than 1.
               {
-              HSColSet colSet;
+		HSColSet colSet(STMTHEAP);
 
               tempColList = "";
               autoGroup = "(";


Mime
View raw message