diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2004-11-02 14:52:23 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2004-11-02 14:52:23 +0000 |
commit | 36e5cd5064d3477a0500f6183d68b18b7493568a (patch) | |
tree | 95d13002a3bca1191e1328de0739dacbb15835ee /xmlmemory.c | |
parent | 032268145fad72bbf00c944c1f6a067e5da4a1e0 (diff) | |
download | android_external_libxml2-36e5cd5064d3477a0500f6183d68b18b7493568a.tar.gz android_external_libxml2-36e5cd5064d3477a0500f6183d68b18b7493568a.tar.bz2 android_external_libxml2-36e5cd5064d3477a0500f6183d68b18b7493568a.zip |
adding xmlMemBlocks() work on generator of an automatic API regression
* xmlmemory.c include/libxml/xmlmemory.h: adding xmlMemBlocks()
* Makefile.am gentest.py testapi.c: work on generator of an
automatic API regression test tool.
* SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c
xmlstring.c: various API hardeing changes as a result of running
teh first set of automatic API regression tests.
* test/slashdot16.xml: apparently missing from CVS, commited it
Daniel
Diffstat (limited to 'xmlmemory.c')
-rw-r--r-- | xmlmemory.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xmlmemory.c b/xmlmemory.c index 821e3b94..69de28d7 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -50,6 +50,7 @@ static int xmlMemInitialized = 0; static unsigned long debugMemSize = 0; +static unsigned long debugMemBlocks = 0; static unsigned long debugMaxMemSize = 0; static xmlMutexPtr xmlMemMutex = NULL; @@ -186,6 +187,7 @@ xmlMallocLoc(size_t size, const char * file, int line) xmlMutexLock(xmlMemMutex); p->mh_number = ++block; debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -253,6 +255,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) xmlMutexLock(xmlMemMutex); p->mh_number = ++block; debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -329,6 +332,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) p->mh_tag = ~MEMTAG; xmlMutexLock(xmlMemMutex); debugMemSize -= p->mh_size; + debugMemBlocks--; #ifdef DEBUG_MEMORY oldsize = p->mh_size; #endif @@ -355,6 +359,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) p->mh_line = line; xmlMutexLock(xmlMemMutex); debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -428,6 +433,7 @@ xmlMemFree(void *ptr) memset(target, -1, p->mh_size); xmlMutexLock(xmlMemMutex); debugMemSize -= p->mh_size; + debugMemBlocks--; #ifdef DEBUG_MEMORY size = p->mh_size; #endif @@ -487,6 +493,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line) xmlMutexLock(xmlMemMutex); p->mh_number = ++block; debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -543,6 +550,19 @@ xmlMemUsed(void) { return(debugMemSize); } +/** + * xmlMemBlocks: + * + * Provides the number of memory areas currently allocated + * + * Returns an int representing the number of blocks + */ + +int +xmlMemBlocks(void) { + return(debugMemBlocks); +} + #ifdef MEM_LIST /** * xmlMemContentShow: |