--- src/TStorage.h	Wed Oct  6 20:53:49 1999
+++ ../2.23/src/TStorage.h	Sun Sep 19 02:59:06 1999
@@ -26,8 +26,8 @@
 class TStorage {
 
 private:
-   static ULong_t        fgLastObject;     // begin address of last allocated obj
-   static ULong_t        fgLastObjectEnd;  // end address of last allocated obj
+   static ULong_t        fgHeapBegin;      // begin address of heap
+   static ULong_t        fgHeapEnd;        // end address of heap
    static size_t         fgMaxBlockSize;   // largest block allocated
    static FreeHookFun_t  fgFreeHook;       // function called on free
    static void          *fgFreeHookData;   // data used by this function
@@ -36,8 +36,8 @@
    static Bool_t         fgHasCustomNewDelete; // true if using ROOT's new/delete
 
 public:
-   static ULong_t       GetLastObject();
-   static ULong_t       GetLastObjectEnd();
+   static ULong_t       GetHeapBegin();
+   static ULong_t       GetHeapEnd();
    static FreeHookFun_t GetFreeHook();
    static void         *GetFreeHookData();
    static size_t        GetMaxBlockSize();
@@ -49,8 +49,6 @@
    static void EnterStat(size_t size, void *p);
    static void RemoveStat(void *p);
    static void PrintStatistics();
-   static void SetLastObject(ULong_t obj);
-   static void SetLastObjectEnd(ULong_t obj);
    static void SetMaxBlockSize(size_t size);
    static void SetFreeHook(FreeHookFun_t func, void *data);
    static void SetReAllocHooks(ReAllocFun_t func1, ReAllocCFun_t func2);
@@ -60,13 +58,18 @@
    static Bool_t HasCustomNewDelete();
 
    // only valid after call to a TStorage allocating method
+   static void   AddToHeap(ULong_t begin, ULong_t end);
    static Bool_t IsOnHeap(void *p);
 
    ClassDef(TStorage,0)  //Storage manager class
 };
 
+inline void   TStorage::AddToHeap(ULong_t begin, ULong_t end)
+   { if (begin < fgHeapBegin) fgHeapBegin = begin;
+     if (end   > fgHeapEnd)   fgHeapEnd   = end; }
+
 inline Bool_t TStorage::IsOnHeap(void *p)
-   { return (ULong_t)p >= fgLastObject && (ULong_t)p < fgLastObjectEnd; }
+   { return (ULong_t)p >= fgHeapBegin && (ULong_t)p < fgHeapEnd; }
 
 #ifndef WIN32
 inline size_t TStorage::GetMaxBlockSize() { return fgMaxBlockSize; }
@@ -74,10 +77,6 @@
 inline void TStorage::SetMaxBlockSize(size_t size) { fgMaxBlockSize = size; }
 
 inline FreeHookFun_t TStorage::GetFreeHook() { return fgFreeHook; }
-
-inline void TStorage::SetLastObject(ULong_t obj) { fgLastObject = obj; }
-
-inline void TStorage::SetLastObjectEnd(ULong_t obj) { fgLastObjectEnd = obj; }
 #endif
 
 #endif
--- src/BASE_Storage.cxx	Wed Jul 28 17:41:01 1999
+++ ../2.23/src/BASE_Storage.cxx	Wed Oct 13 02:01:56 1999
@@ -1,3 +1,5 @@
+//*CMZ :          11/10/99  08.32.36  by  Rene Brun
+//*CMZ :  2.23/03 18/09/99  19.59.06  by  Fons Rademakers
 //*CMZ :  2.21/05 08/02/99  12.32.45  by  Fons Rademakers
 //*CMZ :  2.00/10 14/07/98  18.37.55  by  Fons Rademakers
 //*CMZ :  2.00/06 09/05/98  15.22.42  by  Fons Rademakers
@@ -8,16 +10,10 @@
 //*KEEP,CopyRight,T=C.
 /*************************************************************************
  * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
- * Authors: Rene Brun, Fons Rademakers.                                  *
- * For list of contributors see $ROOTSYS/AA_CREDITS.                     *
+ * Authors: Rene Brun and Fons Rademakers.                               *
  *                                                                       *
- * Permission to use, copy, modify and distribute this software and its  *
- * documentation for non-commercial purposes is hereby granted without   *
- * fee, provided that the above copyright notice appears in all copies   *
- * and that both the copyright notice and this permission notice appear  *
- * in the supporting documentation. The authors make no claims about the *
- * suitability of this software for any purpose. It is provided "as is"  *
- * without express or implied warranty.                                  *
+ * For the licensing terms see $ROOTSYS/AA_LICENSE.                      *
+ * For the list of contributors see $ROOTSYS/AA_CREDITS.                 *
  *************************************************************************/
 //*KEND.
 
@@ -73,8 +69,8 @@
 #endif
 
 
-ULong_t       TStorage::fgLastObject;
-ULong_t       TStorage::fgLastObjectEnd;
+ULong_t       TStorage::fgHeapBegin = (ULong_t)-1L;
+ULong_t       TStorage::fgHeapEnd;
 size_t        TStorage::fgMaxBlockSize;
 FreeHookFun_t TStorage::fgFreeHook;
 void         *TStorage::fgFreeHookData;
@@ -218,20 +214,19 @@
    // after this routine one can call (in the TObject ctor) TStorage::IsOnHeap()
    // to find out if the just created object is on the heap.
 
-   fgLastObject    = (ULong_t) new char[sz];
-   fgLastObjectEnd = fgLastObject + sz;
-   return (void*) fgLastObject;
+   ULong_t space = (ULong_t) new char[sz];
+   AddToHeap(space, space+sz);
+   return (void*) space;
 }
 
 //______________________________________________________________________________
-void *TStorage::ObjectAlloc(size_t sz, void *vp)
+void *TStorage::ObjectAlloc(size_t , void *vp)
 {
-   // Used to allocate a TObject on the heap (via TObject::new()) in
-   // position vp.
+   // Used to allocate a TObject on the heap (via TObject::new(size_t,void*))
+   // in position vp. vp is already allocated (maybe on heap, maybe on
+   // stack) so just return.
 
-   fgLastObject    = (ULong_t) vp;
-   fgLastObjectEnd = fgLastObject + sz;
-   return (void*) fgLastObject;
+   return vp;
 }
 
 //______________________________________________________________________________
@@ -309,15 +304,15 @@
 }
 
 //______________________________________________________________________________
-ULong_t TStorage::GetLastObject()
+ULong_t TStorage::GetHeapBegin()
 {
-   return fgLastObject;
+   return fgHeapBegin;
 }
 
 //______________________________________________________________________________
-ULong_t TStorage::GetLastObjectEnd()
+ULong_t TStorage::GetHeapEnd()
 {
-   return fgLastObjectEnd;
+   return fgHeapEnd;
 }
 
 //______________________________________________________________________________
@@ -354,16 +349,6 @@
 FreeHookFun_t TStorage::GetFreeHook()
 {
    return fgFreeHook;
-}
-//______________________________________________________________________________
-void TStorage::SetLastObject(ULong_t obj)
-{
-   fgLastObject = obj;
-}
-//______________________________________________________________________________
-void TStorage::SetLastObjectEnd(ULong_t obj)
-{
-   fgLastObjectEnd = obj;
 }
 
 #endif
--- src/NEW_NewDelete.cxx	Wed Jul 28 17:41:07 1999
+++ ../2.23/src/NEW_NewDelete.cxx	Wed Oct 13 02:02:01 1999
@@ -1,3 +1,4 @@
+//*CMZ :  2.23/03 18/09/99  19.59.27  by  Fons Rademakers
 //*CMZ :  2.21/05 08/02/99  12.42.39  by  Fons Rademakers
 //*CMZ :  2.00/12 08/10/98  16.23.35  by  Fons Rademakers
 //*CMZ :  2.00/10 15/07/98  16.44.07  by  Fons Rademakers
@@ -9,16 +10,10 @@
 //*KEEP,CopyRight,T=C.
 /*************************************************************************
  * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
- * Authors: Rene Brun, Fons Rademakers.                                  *
- * For list of contributors see $ROOTSYS/AA_CREDITS.                     *
+ * Authors: Rene Brun and Fons Rademakers.                               *
  *                                                                       *
- * Permission to use, copy, modify and distribute this software and its  *
- * documentation for non-commercial purposes is hereby granted without   *
- * fee, provided that the above copyright notice appears in all copies   *
- * and that both the copyright notice and this permission notice appear  *
- * in the supporting documentation. The authors make no claims about the *
- * suitability of this software for any purpose. It is provided "as is"  *
- * without express or implied warranty.                                  *
+ * For the licensing terms see $ROOTSYS/AA_LICENSE.                      *
+ * For the list of contributors see $ROOTSYS/AA_CREDITS.                 *
  *************************************************************************/
 //*KEND.
 
@@ -282,8 +277,6 @@
    if ((long)ptr == gvp && gvp != G__PVOID) return;
 #endif
 #endif
-   TStorage::SetLastObject(0);
-   TStorage::SetLastObjectEnd(0);
    if (ptr) {
       CheckObjPtr(ptr, where);
       CallFreeHook(ptr, storage_size(ptr));
