gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash libbase/memory.cpp ChangeLog libbase/gmem...


From: Rob Savoye
Subject: [Gnash-commit] gnash libbase/memory.cpp ChangeLog libbase/gmem...
Date: Fri, 07 Mar 2008 02:09:34 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    08/03/07 02:09:34

Modified files:
        libbase        : memory.cpp 
        .              : ChangeLog 
Added files:
        libbase        : gmemory.h 
Removed files:
        libbase        : memory.h 

Log message:
                * libbase/gmemory.h: Renamed from memory.h to avoid name
                collisions. 
                * libbase/memory.h: Renamed to gmemory.h to avoid name
                collisions. 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/memory.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/gmemory.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/memory.h?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5836&r2=1.5837

Patches:
Index: libbase/memory.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/memory.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libbase/memory.cpp  7 Mar 2008 01:02:20 -0000       1.1
+++ libbase/memory.cpp  7 Mar 2008 02:09:33 -0000       1.2
@@ -31,7 +31,7 @@
 #include <vector>
 
 #include "log.h"
-#include "memory.h"
+#include "gmemory.h"
 
 using namespace std;
 

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5836
retrieving revision 1.5837
diff -u -b -r1.5836 -r1.5837
--- ChangeLog   7 Mar 2008 01:35:03 -0000       1.5836
+++ ChangeLog   7 Mar 2008 02:09:33 -0000       1.5837
@@ -1,3 +1,10 @@
+2008-03-06  Rob Savoye  <address@hidden>
+
+       * libbase/gmemory.h: Renamed from memory.h to avoid name
+       collisions. 
+       * libbase/memory.h: Renamed to gmemory.h to avoid name
+       collisions. 
+
 2008-03-06  Rob Savoye  <address@hidden>
 
        * configure.ac: Add a test for mallinfo();

Index: libbase/gmemory.h
===================================================================
RCS file: libbase/gmemory.h
diff -N libbase/gmemory.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libbase/gmemory.h   7 Mar 2008 02:09:32 -0000       1.1
@@ -0,0 +1,111 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+// This class is a memory allocation tracker used to optimize
+// the memory usage and find memory leaks.
+//
+#ifndef __MEMORY_H__
+#define __MEMORY_H__
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+// If we don't have support for mallinfo(), this code is useless
+#ifdef HAVE_MALLINFO
+
+#include <stdlib.h>
+#include <malloc.h>
+
+namespace gnash {
+  
+class Memory {
+public:
+
+    // Borrowed from malloc.h and trimmed down.
+    struct small_mallinfo {
+        int line;     // line number of this data sample
+        int arena;    // non-mmapped space allocated from system
+        int uordblks; // total allocated space
+        int fordblks; // total free space
+    };
+    DSOEXPORT Memory();
+    DSOEXPORT Memory(int size);
+    DSOEXPORT ~Memory();
+
+    // Start collecting statistics. This can effect performance
+    void startStats();
+    
+    // Stop collecting statistics
+    void endStats() { addStats();_collecting = false; };
+
+    // Erase all collected data and reset collections.
+    void reset();
+
+    // checkpoint()
+    void startCheckpoint() { _checkpoint[0] = mallinfo(); };
+    bool endCheckpoint();
+    
+    // Add or retrieve mallinfo data
+    int addStats();
+    int addStats(int line);
+    int addStats(struct small_mallinfo *x);
+    int addStats(struct small_mallinfo *x, int line);
+    struct small_mallinfo *getStats() { return _info; };
+    struct small_mallinfo *operator[](int x) { return _info + x; };
+    int totalStats() { return _index; };
+
+    // Analyze memory usage
+    bool analyze();
+
+    // Dump the differences of bytes allocated between two samples
+    int diffStats();
+    int diffStats(int x, int y);
+    
+    // Dump the vector of stored classes
+    void dump(struct mallinfo *x);
+    void dump(struct small_mallinfo *x);
+    void dump();
+private:
+    bool                _collecting;
+    // For data logging, we want to store as little as possible
+    // so we don't impact the system too hard. Data logging memory
+    // allocations can generate a huge amount of data, so we have
+    // to be careful. We also can't use STL, as that does more
+    // memory allocations, which will confuse our statistics
+    // gathering.
+    struct small_mallinfo *_info;
+    // Since we aren't using STL, we have to store how much
+    // data storage we have ourselves.
+    size_t              _size;
+    int                 _index;
+    // For checkpoints, we want the all the data
+    struct mallinfo     _checkpoint[2];
+};
+
+} // end of gnash namespace
+
+#endif // end of HAVE_MALLINFO
+
+// end of __MEMORY_H__
+#endif
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: libbase/memory.h
===================================================================
RCS file: libbase/memory.h
diff -N libbase/memory.h
--- libbase/memory.h    7 Mar 2008 01:02:19 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,111 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-// This class is a memory allocation tracker used to optimize
-// the memory usage and find memory leaks.
-//
-#ifndef __MEMORY_H__
-#define __MEMORY_H__
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-// If we don't have support for mallinfo(), this code is useless
-#if HAVE_MALLINFO
-
-#include <cstdlib>
-#include <malloc.h>
-
-namespace gnash {
-  
-class Memory {
-public:
-
-    // Borrowed from malloc.h and trimmed down.
-    struct small_mallinfo {
-        int line;     // line number of this data sample
-        int arena;    // non-mmapped space allocated from system
-        int uordblks; // total allocated space
-        int fordblks; // total free space
-    };
-    DSOEXPORT Memory();
-    DSOEXPORT Memory(int size);
-    DSOEXPORT ~Memory();
-
-    // Start collecting statistics. This can effect performance
-    void startStats();
-    
-    // Stop collecting statistics
-    void endStats() { addStats();_collecting = false; };
-
-    // Erase all collected data and reset collections.
-    void reset();
-
-    // checkpoint()
-    void startCheckpoint() { _checkpoint[0] = mallinfo(); };
-    bool endCheckpoint();
-    
-    // Add or retrieve mallinfo data
-    int addStats();
-    int addStats(int line);
-    int addStats(struct small_mallinfo *x);
-    int addStats(struct small_mallinfo *x, int line);
-    struct small_mallinfo *getStats() { return _info; };
-    struct small_mallinfo *operator[](int x) { return _info + x; };
-    int totalStats() { return _index; };
-
-    // Analyze memory usage
-    bool analyze();
-
-    // Dump the differences of bytes allocated between two samples
-    int diffStats();
-    int diffStats(int x, int y);
-    
-    // Dump the vector of stored classes
-    void dump(struct mallinfo *x);
-    void dump(struct small_mallinfo *x);
-    void dump();
-private:
-    bool                _collecting;
-    // For data logging, we want to store as little as possible
-    // so we don't impact the system too hard. Data logging memory
-    // allocations can generate a huge amount of data, so we have
-    // to be careful. We also can't use STL, as that does more
-    // memory allocations, which will confuse our statistics
-    // gathering.
-    struct small_mallinfo *_info;
-    // Since we aren't using STL, we have to store how much
-    // data storage we have ourselves.
-    size_t              _size;
-    int                 _index;
-    // For checkpoints, we want the all the data
-    struct mallinfo     _checkpoint[2];
-};
-
-} // end of gnash namespace
-
-#endif // end of HAVE_MALLINFO
-
-// end of __MEMORY_H__
-#endif
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]