#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include "myalloc.h"
Go to the source code of this file.
Data Structures | |
struct | _AllocUnit |
struct | _MyAlloc |
Defines | |
#define | MTHREAD 0 |
#define | LOCK_SEGMENT |
#define | UNLOCK_SEGMENT |
#define | LOCK_MALLOC |
#define | UNLOCK_MALLOC |
#define | LOCK_STAT |
#define | UNLOCK_STAT |
#define | STAT_ADD(NET, BRU) |
#define | STAT_SUB(NET, BRU) |
#define | EXTRA_BYTE (1) |
Typedefs | |
typedef _AllocUnit | AllocUnit |
typedef _AllocUnit * | pAllocUnit |
typedef _MyAlloc | MyAlloc |
typedef _MyAlloc * | pMyAlloc |
Functions | |
void * | alloc_InitSegment (void *(*maf)(size_t), void(*mrf)(void *)) |
void | alloc_GlobalUseGlobalMutex () |
long | alloc_SegmentLimit (void *p, unsigned long NewMaxSize) |
void | alloc_FreeSegment (void *p) |
void | alloc_FinishSegment (void *p) |
void * | alloc_Alloc (size_t n, void *p) |
void | alloc_Free (void *pMem, void *p) |
void | alloc_Merge (void *p1, void *p2) |
void | alloc_MergeAndFinish (void *p1, void *p2) |
void | alloc_InitStat () |
void | alloc_GlobalGetStat (unsigned long *pNetMax, unsigned long *pNetMin, unsigned long *pBruMax, unsigned long *pBruMin, unsigned long *pNetSize, unsigned long *pBruSize) |
void | alloc_GetStat (void *p, unsigned long *pMax, unsigned long *pMin, unsigned long *pActSize) |
Variables | |
static unsigned long | MaxNetSize |
static unsigned long | MinNetSize |
static unsigned long | MaxBruSize |
static unsigned long | MinBruSize |
static unsigned long | ActNetSize |
static unsigned long | ActBruSize |
|
Referenced by alloc_Alloc(). |
|
Definition at line 64 of file myalloc.c. Referenced by alloc_Alloc(), alloc_FinishSegment(), alloc_Free(), and alloc_FreeSegment(). |
|
Definition at line 62 of file myalloc.c. Referenced by alloc_Alloc(), alloc_Free(), alloc_FreeSegment(), alloc_GetStat(), and alloc_SegmentLimit(). |
|
Definition at line 66 of file myalloc.c. Referenced by alloc_GlobalGetStat(). |
|
|
|
Value: LOCK_STAT \ ActNetSize += (NET); \ if( ActNetSize > MaxNetSize )MaxNetSize = ActNetSize; \ if( ActNetSize < MinNetSize )MinNetSize = ActNetSize; \ ActBruSize += (BRU); \ if( ActBruSize > MaxBruSize )MaxBruSize = ActBruSize; \ if( ActBruSize < MinBruSize )MinBruSize = ActBruSize; \ UNLOCK_STAT Definition at line 71 of file myalloc.c. Referenced by alloc_Alloc(), and alloc_InitSegment(). |
|
Value: LOCK_STAT \ ActNetSize -= (NET); \ if( ActNetSize > MaxNetSize )MaxNetSize = ActNetSize; \ if( ActNetSize < MinNetSize )MinNetSize = ActNetSize; \ ActBruSize -= (BRU); \ if( ActBruSize > MaxBruSize )MaxBruSize = ActBruSize; \ if( ActBruSize < MinBruSize )MinBruSize = ActBruSize; \ UNLOCK_STAT Definition at line 80 of file myalloc.c. Referenced by alloc_FinishSegment(), alloc_Free(), and alloc_FreeSegment(). |
|
Definition at line 65 of file myalloc.c. Referenced by alloc_Alloc(), alloc_FinishSegment(), alloc_Free(), and alloc_FreeSegment(). |
|
Definition at line 63 of file myalloc.c. Referenced by alloc_Alloc(), alloc_Free(), alloc_FreeSegment(), alloc_GetStat(), and alloc_SegmentLimit(). |
|
Definition at line 67 of file myalloc.c. Referenced by alloc_GlobalGetStat(). |
|
|
|
|
|
|
|
|
|
|
Definition at line 297 of file myalloc.c. References alloc_FreeSegment(), LOCK_MALLOC, _MyAlloc::memory_releasing_function, STAT_SUB, thread_FinishMutex(), and UNLOCK_MALLOC. Referenced by alloc_MergeAndFinish(), epreproc(), ex_free(), HttpExtensionProc(), ipreproc_DeletePreprocessor(), ipreproc_PurgePreprocessorMemory(), main(), modu_Init(), scriba_destroy(), scriba_new(), scriba_PurgeBuilderMemory(), scriba_PurgeExecuteMemory(), scriba_PurgeLexerMemory(), scriba_PurgeReaderMemory(), and TerminateExtension(). |
|
|
Definition at line 260 of file myalloc.c. References _MyAlloc::CurrentSize, _MyAlloc::FirstUnit, LOCK_MALLOC, LOCK_SEGMENT, _MyAlloc::memory_releasing_function, _MyAlloc::MinNetSize, _AllocUnit::next, NULL, _AllocUnit::Size, STAT_SUB, UNLOCK_MALLOC, and UNLOCK_SEGMENT. Referenced by alloc_FinishSegment(), and modu_Init(). |
|
Definition at line 591 of file myalloc.c. References _MyAlloc::CurrentSize, LOCK_SEGMENT, _MyAlloc::MaxNetSize, _MyAlloc::MinNetSize, and UNLOCK_SEGMENT. |
|
Definition at line 553 of file myalloc.c. References ActBruSize, ActNetSize, LOCK_STAT, MaxBruSize, MaxNetSize, MinBruSize, MinNetSize, and UNLOCK_STAT. |
|
Definition at line 199 of file myalloc.c. References thread_InitMutex(). |
|
|
Definition at line 525 of file myalloc.c. References ActBruSize, ActNetSize, MaxBruSize, MaxNetSize, MinBruSize, MinNetSize, and thread_InitMutex(). |
|
Definition at line 454 of file myalloc.c. References _MyAlloc::CurrentSize, _MyAlloc::FirstUnit, next, NULL, p, _AllocUnit::prev, q, thread_LockMutex(), and thread_UnlockMutex(). Referenced by alloc_MergeAndFinish(), and HttpExtensionProc(). |
|
Definition at line 506 of file myalloc.c. References alloc_FinishSegment(), and alloc_Merge(). |
|
Definition at line 235 of file myalloc.c. References LOCK_SEGMENT, _MyAlloc::MaxSize, and UNLOCK_SEGMENT. Referenced by execute_InitStructure(), main(), and modu_Init(). |
|
Definition at line 39 of file myalloc.c. Referenced by alloc_GlobalGetStat(), and alloc_InitStat(). |
|
Definition at line 39 of file myalloc.c. Referenced by alloc_GlobalGetStat(), and alloc_InitStat(). |
|
Definition at line 39 of file myalloc.c. Referenced by alloc_GlobalGetStat(), and alloc_InitStat(). |
|
Definition at line 39 of file myalloc.c. Referenced by alloc_GlobalGetStat(), and alloc_InitStat(). |
|
Definition at line 39 of file myalloc.c. Referenced by alloc_GlobalGetStat(), and alloc_InitStat(). |
|
Definition at line 39 of file myalloc.c. Referenced by alloc_GlobalGetStat(), and alloc_InitStat(). |