| OLD | NEW |
| 1 /* | 1 /* |
| 2 * xmlmemory.c: libxml memory allocator wrapper. | 2 * xmlmemory.c: libxml memory allocator wrapper. |
| 3 * | 3 * |
| 4 * daniel@veillard.com | 4 * daniel@veillard.com |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #define IN_LIBXML | 7 #define IN_LIBXML |
| 8 #include "libxml.h" | 8 #include "libxml.h" |
| 9 | 9 |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 /** | 547 /** |
| 548 * xmlMemUsed: | 548 * xmlMemUsed: |
| 549 * | 549 * |
| 550 * Provides the amount of memory currently allocated | 550 * Provides the amount of memory currently allocated |
| 551 * | 551 * |
| 552 * Returns an int representing the amount of memory allocated. | 552 * Returns an int representing the amount of memory allocated. |
| 553 */ | 553 */ |
| 554 | 554 |
| 555 int | 555 int |
| 556 xmlMemUsed(void) { | 556 xmlMemUsed(void) { |
| 557 return(debugMemSize); | 557 int res; |
| 558 |
| 559 xmlMutexLock(xmlMemMutex); |
| 560 res = debugMemSize; |
| 561 xmlMutexUnlock(xmlMemMutex); |
| 562 return(res); |
| 558 } | 563 } |
| 559 | 564 |
| 560 /** | 565 /** |
| 561 * xmlMemBlocks: | 566 * xmlMemBlocks: |
| 562 * | 567 * |
| 563 * Provides the number of memory areas currently allocated | 568 * Provides the number of memory areas currently allocated |
| 564 * | 569 * |
| 565 * Returns an int representing the number of blocks | 570 * Returns an int representing the number of blocks |
| 566 */ | 571 */ |
| 567 | 572 |
| 568 int | 573 int |
| 569 xmlMemBlocks(void) { | 574 xmlMemBlocks(void) { |
| 570 return(debugMemBlocks); | 575 int res; |
| 576 |
| 577 xmlMutexLock(xmlMemMutex); |
| 578 res = debugMemBlocks; |
| 579 xmlMutexUnlock(xmlMemMutex); |
| 580 return(res); |
| 571 } | 581 } |
| 572 | 582 |
| 573 #ifdef MEM_LIST | 583 #ifdef MEM_LIST |
| 574 /** | 584 /** |
| 575 * xmlMemContentShow: | 585 * xmlMemContentShow: |
| 576 * @fp: a FILE descriptor used as the output file | 586 * @fp: a FILE descriptor used as the output file |
| 577 * @p: a memory block header | 587 * @p: a memory block header |
| 578 * | 588 * |
| 579 * tries to show some content from the memory block | 589 * tries to show some content from the memory block |
| 580 */ | 590 */ |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 if (freeFunc != NULL) *freeFunc = xmlFree; | 1125 if (freeFunc != NULL) *freeFunc = xmlFree; |
| 1116 if (mallocFunc != NULL) *mallocFunc = xmlMalloc; | 1126 if (mallocFunc != NULL) *mallocFunc = xmlMalloc; |
| 1117 if (mallocAtomicFunc != NULL) *mallocAtomicFunc = xmlMallocAtomic; | 1127 if (mallocAtomicFunc != NULL) *mallocAtomicFunc = xmlMallocAtomic; |
| 1118 if (reallocFunc != NULL) *reallocFunc = xmlRealloc; | 1128 if (reallocFunc != NULL) *reallocFunc = xmlRealloc; |
| 1119 if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup; | 1129 if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup; |
| 1120 return(0); | 1130 return(0); |
| 1121 } | 1131 } |
| 1122 | 1132 |
| 1123 #define bottom_xmlmemory | 1133 #define bottom_xmlmemory |
| 1124 #include "elfgcchack.h" | 1134 #include "elfgcchack.h" |
| OLD | NEW |