36#ifndef G4EnhancedVecAllocator_hh
37#define G4EnhancedVecAllocator_hh 1
74 template<
typename _Tp1>
80 :
std::allocator<_Tp>() {;}
82 template<
typename _Tp1>
84 :
std::allocator<_Tp>() {;}
90 void deallocate(_Tp* _Ptr, std::size_t _Count);
92 _Tp*
allocate(std::size_t _Count,
void *
const hint = 0);
106template<
typename _Tp>
127 if ( (chunk.
preAllocated[k]).address == ((
char *) _Ptr))
141template<
typename _Tp>
144template<
typename _Tp>
148 std::size_t totalsize = _Count *
sizeof(_Tp);
195 char *newSpace1 = (
char *) malloc(totalsize * 512);
200 for (
auto k = 0; k < 512 ; ++k)
203 (chunk.
preAllocated[k]).address = newSpace1+totalsize*k;
233 char *newSpace = (
char *) malloc(totalsize * 512);
238 for (
auto k = 0; k < 512 ; ++k)
240 (chunk.
preAllocated[originalchunknumber+k]).isAllocated = 0;
241 (chunk.
preAllocated[originalchunknumber+k]).address = newSpace+totalsize*k;
244 (chunk.
preAllocated[originalchunknumber]).isAllocated = 1;
246 return (_Tp*)((chunk.
preAllocated[originalchunknumber]).address);
253template<
typename _T1,
typename _T2>
262template<
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
static G4ThreadLocal G4int numCat
void deallocate(_Tp *_Ptr, std::size_t _Count)
~G4EnhancedVecAllocator()
_Tp * allocate(std::size_t _Count)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp > &)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp1 > &)
G4ChunkType * preAllocated
G4EnhancedVecAllocator< _Tp1 > other