#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <windows.h>
#include <winsock.h>
#include <richedit.h>
#include <assert.h>
#include "NanoMud.h"
Include dependency graph for nanomud-memory.c:

Go to the source code of this file.
Functions | |
| void | nano_free (void *seg, const char *file, int line) |
| void * | nano_malloc (size_t chunk, const char *file, int line) |
| void | nano_realloc (void *seg, size_t sz, const char *file, int line) |
| void | return_usage (void) |
Variables | |
| unsigned long int | free_calls = 0 |
| unsigned long int | full_mem = 0 |
| unsigned long int | malloc_calls = 0 |
| const unsigned char | uninit = 0x0 |
|
||||||||||||||||
|
Definition at line 74 of file nanomud-memory.c. References free, free_calls, and full_mem. 00075 {
00076 if (seg == NULL)
00077 {
00078 //LOG("ERROR: Free %p Was a Null. Not Freeing. Requested from line: %d file: %s. Returning.", seg,line,file);
00079 return;
00080 }
00081 if (IS_IN_DEBUGGING_MODE)
00082 //LOG("FREE: Freeing %p with a size of %d at line %d of file %s", seg,
00083 // sizeof(seg), line,file);
00084 full_mem -= sizeof(seg);
00085 free(seg);
00086 free_calls++;
00087
00088
00089 return;
00090 }
|
|
||||||||||||||||
|
Definition at line 44 of file nanomud-memory.c. References full_mem, LOG(), malloc, and malloc_calls. 00045 {
00046
00047
00048 unsigned char* to_return;
00049 register upper_mult;
00050
00051 //upper_mult = 16 * ((chunk / 16) + ((chunk % 16) == 0));
00052 upper_mult = chunk;
00053
00054
00055 to_return = malloc(chunk);
00056
00057
00058 if (to_return == 0)
00059 {
00060 char buf[500];
00061 sprintf(buf, "ERROR: Malloc of %p returned NULL! Requested from line: %d file: %s. Quiting.", to_return,line,file);
00062 LOG(buf);
00063 }
00064 malloc_calls++;
00065 full_mem += (unsigned int) sizeof(to_return);
00066 ZeroMemory(to_return, sizeof(to_return));
00067 if (IS_IN_DEBUGGING_MODE)
00068 LOG("MALLOC: %p with a size of %d bytes malloced at line %d of file %s", to_return,
00069 (int)sizeof(to_return),line, file);
00070
00071 return (void*)to_return;
00072 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 92 of file nanomud-memory.c. References realloc. 00093 {
00094
00095
00096
00097 realloc(seg, sz);
00098 return;
00099 }
|
|
|
Definition at line 104 of file nanomud-memory.c. References free_calls, full_mem, LOG(), and malloc_calls. Referenced by WindowProcedure(). 00105 {
00106 if (IS_IN_DEBUGGING_MODE)
00107 LOG("REPORT: Memory usage this run: %ld\nREPORT: Calls to malloc: %d\nREPORT: Calls to free: %d", full_mem, malloc_calls, free_calls);
00108 return;
00109 }
|
Here is the call graph for this function:

|
|
Definition at line 38 of file nanomud-memory.c. Referenced by nano_free(), and return_usage(). |
|
|
Definition at line 36 of file nanomud-memory.c. Referenced by nano_free(), nano_malloc(), and return_usage(). |
|
|
Definition at line 37 of file nanomud-memory.c. Referenced by nano_malloc(), and return_usage(). |
|
|
Definition at line 39 of file nanomud-memory.c. |
1.3.9.1