1 #ifndef __JLANG__JRAM__
2 #define __JLANG__JRAM__
15 namespace JPP {
using namespace JLANG; }
46 const std::size_t size = this->size();
50 iterator q = this->begin();
54 for ( ; q != this->end(); buffer +=
BLOCK_SIZE, ++q) {
66 JRAM(
const std::size_t block_size,
67 const std::size_t number_of_blocks = 65536) :
122 return *(this->end());
144 sort(this->begin(), this->end());
146 vector<unsigned char*>::iterator __end =
memory.end();
148 for (vector<unsigned char*>::iterator
i =
memory.begin();
i != __end; ) {
150 iterator p = lower_bound(this->begin(), this->end(), *
i);
155 ((
unsigned char*) (*q) - (
unsigned char*) *p) == (
int) (
BLOCK_SIZE * (numberOfBlocks - 1))) {
157 iter_swap(
i, --__end);
void * allocate()
Allocate memory.
JRAM(const std::size_t block_size, const std::size_t number_of_blocks=65536)
Constructor.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
const std::size_t BLOCK_SIZE
JRAM & operator=(const JRAM &)
void addMemory()
Add memory.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
long long int getFreeRAM()
Get total free RAM.
const std::size_t numberOfBlocks
std::vector< unsigned char * > memory
long long int getTotalRAM()
Get total used RAM.
void gc()
Run garbage collector.
Memory management for small objects.
void free(void *p)
Deallocate memory.