Eneboo - Documentación para desarrolladores
src/hoard/src/heaplayers/leamallocheap.h
Ir a la documentación de este archivo.
00001 // -*- C++ -*-
00002 
00003 /*
00004 
00005   Heap Layers: An Extensible Memory Allocation Infrastructure
00006   
00007   Copyright (C) 2000-2003 by Emery Berger
00008   http://www.cs.umass.edu/~emery
00009   emery@cs.umass.edu
00010   
00011   This program is free software; you can redistribute it and/or modify
00012   it under the terms of the GNU General Public License as published by
00013   the Free Software Foundation; either version 2 of the License, or
00014   (at your option) any later version.
00015   
00016   This program is distributed in the hope that it will be useful,
00017   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019   GNU General Public License for more details.
00020   
00021   You should have received a copy of the GNU General Public License
00022   along with this program; if not, write to the Free Software
00023   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025 */
00026 
00027 #ifndef _LEAMALLOCHEAP_H_
00028 #define _LEAMALLOCHEAP_H_
00029 
00030 #include <cstdlib>
00031 
00037 extern "C" void * dlmalloc (size_t);
00038 extern "C" void   dlfree (void *);
00039 extern "C" size_t dlmalloc_usable_size (void *);
00040 
00041 namespace HL {
00042 
00043 class LeaMallocHeap {
00044  public:
00045   inline void * malloc (size_t sz) {
00046     void * ptr = dlmalloc (sz);
00047     return ptr;
00048   }
00049 
00050   inline void free (void * p) {
00051     dlfree (p);
00052   }
00053 
00054   inline size_t getSize (const void * p) {
00055     return dlmalloc_usable_size ((void *) p);
00056   }
00057 };
00058 
00059 };
00060 
00061 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'