Ares
Public Types | Static Public Member Functions | Static Public Attributes

MemMap Class Reference

#include <src/Ares.h>

List of all members.

Public Types

typedef hash_map< DWORD, size_t > memmap

Static Public Member Functions

static void Add (void *_addr, size_t amount)
static size_t Remove (void *_addr)

Static Public Attributes

static hash_map< DWORD, size_t > AllocMap
static size_t Total

Member Typedef Documentation

typedef hash_map<DWORD, size_t> MemMap::memmap

Member Function Documentation

static void MemMap::Add ( void *  _addr,
size_t  amount 
) [inline, static]
                                                     {
                DWORD addr = (DWORD)_addr;
                memmap::iterator i = AllocMap.find(addr);
                if(i != AllocMap.end()) {
#ifdef MEMORY_LOGGING
                        Debug::Log("Reallocated a used block of 0x%X bytes @ 0x%X!\n", amount, addr);
#endif
                }
                AllocMap[addr] = amount;
                Total += amount;
        }
static size_t MemMap::Remove ( void *  _addr) [inline, static]
                                           {
                DWORD addr = (DWORD)_addr;
                memmap::iterator i = AllocMap.find(addr);
                if(i == AllocMap.end()) {
#ifdef MEMORY_LOGGING
                        Debug::Log("Deallocated a dud block @ 0x%X!\n", addr);
#endif
                        return 0;
                } else {
                        size_t amount = AllocMap[addr];
                        Total -= amount;
                        AllocMap.erase(addr);
                        return amount;
                }
        }

Member Data Documentation

hash_map< DWORD, size_t > MemMap::AllocMap [static]
size_t MemMap::Total [static]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines