aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <>2004-04-13 09:13:00 +0000
committerschnetter <>2004-04-13 09:13:00 +0000
commit4c9de1248d2a16d3a915e3c1bff4f87ee76e3293 (patch)
tree2e0767352d212411053f35d32795fa73493b8cb9
parent2e58474fc9fa5128315453abd08b87ac7f35b670 (diff)
Comment
darcs-hash:20040413091349-07bb3-52f2c2f87c5c51b61b6cc2d609d985b1e24a846b.gz
-rw-r--r--Carpet/CarpetLib/src/data.cc15
-rw-r--r--Carpet/CarpetLib/src/data.hh4
2 files changed, 9 insertions, 10 deletions
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc
index ce4efe3be..7eee3d45f 100644
--- a/Carpet/CarpetLib/src/data.cc
+++ b/Carpet/CarpetLib/src/data.cc
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.51 2004/04/13 11:01:44 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.52 2004/04/13 11:13:49 schnetter Exp $
#include <assert.h>
#include <limits.h>
@@ -26,8 +26,7 @@ using namespace std;
-// Track all allocated storage
-static size_t allocated_bytes = 0;
+static size_t total_allocated_bytes; // total number of allocated bytes
@@ -37,7 +36,7 @@ data<T,D>::data (const int varindex_, const operator_type transport_operator_,
const int vectorlength, const int vectorindex,
data* const vectorleader)
: gdata<D>(varindex_, transport_operator_),
- _storage(0), _allocated_bytes(0),
+ _storage(NULL), _allocated_bytes(0),
vectorlength(vectorlength), vectorindex(vectorindex),
vectorleader(vectorleader)
{
@@ -53,7 +52,7 @@ data<T,D>::data (const int varindex_, const operator_type transport_operator_,
data* const vectorleader,
const ibbox& extent_, const int proc_)
: gdata<D>(varindex_, transport_operator_),
- _storage(0), _allocated_bytes(0),
+ _storage(NULL), _allocated_bytes(0),
vectorlength(vectorlength), vectorindex(vectorindex),
vectorleader(vectorleader)
{
@@ -97,9 +96,9 @@ void data<T,D>::getmem (const size_t nelems)
"Failed to allocate %f bytes (%.3f MB) of memory for type %s. %f bytes (%.3f MB) are currently allocated.",
(double)nbytes, nbytes/1.0e6,
typestring(Tdummy),
- (double)allocated_bytes, allocated_bytes/1.0e6);
+ (double)total_allocated_bytes, total_allocated_bytes/1.0e6);
}
- allocated_bytes += nbytes;
+ total_allocated_bytes += nbytes;
}
@@ -108,7 +107,7 @@ template<class T, int D>
void data<T,D>::freemem ()
{
delete [] _storage;
- allocated_bytes -= this->_allocated_bytes;
+ total_allocated_bytes -= this->_allocated_bytes;
this->_allocated_bytes = 0;
}
diff --git a/Carpet/CarpetLib/src/data.hh b/Carpet/CarpetLib/src/data.hh
index b12b6c48d..961e9020c 100644
--- a/Carpet/CarpetLib/src/data.hh
+++ b/Carpet/CarpetLib/src/data.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.hh,v 1.20 2004/04/08 11:16:35 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.hh,v 1.21 2004/04/13 11:13:48 schnetter Exp $
#ifndef DATA_HH
#define DATA_HH
@@ -31,7 +31,7 @@ class data: public gdata<D>
// Fields
T* _storage; // the data (if located on this processor)
- size_t _allocated_bytes;
+ size_t _allocated_bytes; // number of allocated bytes
int vectorlength;
int vectorindex;