1#ifndef __JLANG__JALLOCATOR__ 
    2#define __JLANG__JALLOCATOR__ 
   16namespace JPP { 
using namespace JLANG; }
 
   40      buffer = 
new unsigned char[block_size * number_of_blocks];
 
   43        THROW(
JException, 
"JAllocatorBuffer::init(): not enough space in memory.");
 
   50      for (
JBlock_t i = 0; i != number_of_blocks; p += block_size) {
 
 
   65    inline void* 
allocate(
const std::size_t block_size)
 
 
   83    void free(
void* p, 
const std::size_t block_size)
 
   85      unsigned char* q = 
static_cast<unsigned char*
>(p);
 
   96        THROW(
JException, 
"JAllocatorBuffer::free(): failed truncation check.");
 
 
 
  137               const JBlock_t      number_of_blocks = std::numeric_limits<JBlock_t>::max()) :
 
 
  166      for (const_iterator i = this->begin(); i != this->end(); ++i) {
 
  167        n += i->numberOfFreeBlocks;
 
 
  183        for (iterator i = this->begin(); ; ++i) {
 
  185          if (i == this->end()) {
 
  194          if (i->numberOfFreeBlocks != 0) {
 
 
  221      if (this->size() != 1) {
 
  223        if (p <  pDealloc->buffer ||
 
  228            if (p >= i->buffer && 
 
  251          if (i != this->rend()) {
 
  253            delete [] this->rbegin()->buffer;
 
 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
Memory management for small objects.
 
JAllocatorBuffer * pDealloc
 
long long int getTotalRAM()
Get total used RAM.
 
JAllocator(const std::size_t block_size, const JBlock_t number_of_blocks=std::numeric_limits< JBlock_t >::max())
Constructor.
 
JAllocatorBuffer::JBlock_t JBlock_t
 
void * allocate()
Allocate memory.
 
void free(void *p)
Deallocate memory.
 
long long int getFreeRAM()
Get total free RAM.
 
JAllocatorBuffer * pAlloc
 
Auxiliary classes and methods for language specific functionality.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Low-level memory management.
 
JBlock_t firstAvailableBlock
 
JAllocatorBuffer(const std::size_t block_size, const JBlock_t number_of_blocks)
Constructor.
 
JBlock_t numberOfFreeBlocks
 
void free(void *p, const std::size_t block_size)
Deallocate memory.
 
void * allocate(const std::size_t block_size)
Allocate memory.