36#ifndef G4EnhancedVecAllocator_hh
37#define G4EnhancedVecAllocator_hh
80 template<
typename _Tp1>
86 :
std::allocator<_Tp>() {;}
88 template<
typename _Tp1>
90 :
std::allocator<_Tp>() {;}
98 _Tp*
allocate(std::size_t _Count,
void *
const hint = 0);
112template<
typename _Tp>
133 if ( (chunk.
preAllocated[k]).address == ((
char *) _Ptr))
147template<
typename _Tp>
150template<
typename _Tp>
154 std::size_t totalsize = _Count *
sizeof(_Tp);
201 char *newSpace1 = (
char *)
malloc(totalsize * 512);
206 for (
auto k = 0; k < 512 ; ++k)
209 (chunk.
preAllocated[k]).address = newSpace1+totalsize*k;
239 char *newSpace = (
char *)
malloc(totalsize * 512);
244 for (
auto k = 0; k < 512 ; ++k)
246 (chunk.
preAllocated[originalchunknumber+k]).isAllocated = 0;
247 (chunk.
preAllocated[originalchunknumber+k]).address = newSpace+totalsize*k;
250 (chunk.
preAllocated[originalchunknumber]).isAllocated = 1;
252 return (_Tp*)((chunk.
preAllocated[originalchunknumber]).address);
259template<
typename _T1,
typename _T2>
268template<
typename _T1,
typename _T2>
G4bool operator!=(const G4EnhancedVecAllocator< _T1 > &, const G4EnhancedVecAllocator< _T2 > &)
G4bool operator==(const G4EnhancedVecAllocator< _T1 > &, const G4EnhancedVecAllocator< _T2 > &)
static G4ThreadLocal G4int totSpace
static G4ThreadLocal G4ChunkIndexType * allocStat
Utility class, placeholder for global data on allocation. Initialisation to zero of the data below mu...
static G4ThreadLocal G4int numCat
G4EnhancedVecAllocator is a class for fast allocation of STL vectors through a static pool....
void deallocate(_Tp *_Ptr, std::size_t _Count)
~G4EnhancedVecAllocator()
_Tp * allocate(std::size_t _Count)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp > &)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp1 > &)
allocation_function xml_memory_management_function_storage< T >::allocate
G4ChunkType * preAllocated
G4EnhancedVecAllocator< _Tp1 > other