44 #ifndef G4EnhancedVecAllocator_h
45 #define G4EnhancedVecAllocator_h 1
79 template<
typename _Tp>
84 template<
typename _Tp1>
90 :
std::allocator<_Tp>() {;}
92 template<
typename _Tp1>
94 :
std::allocator<_Tp>() {;}
102 _Tp*
allocate(
size_t _Count,
void *
const hint = 0);
116 template<
typename _Tp>
137 if ( (chunk.
preAllocated[k]).address == ((
char *) _Ptr))
151 template<
typename _Tp>
154 template<
typename _Tp>
158 size_t totalsize = _Count *
sizeof(_Tp);
205 char *newSpace1 = (
char *) malloc(totalsize * 512);
210 for (
G4int k = 0; k < 512 ; k++)
213 (chunk.
preAllocated[k]).address = newSpace1+totalsize*k;
243 char *newSpace = (
char *) malloc(totalsize * 512);
248 for (
G4int k = 0; k < 512 ; k++)
250 (chunk.
preAllocated[originalchunknumber+k]).isAllocated = 0;
251 (chunk.
preAllocated[originalchunknumber+k]).address = newSpace+totalsize*k;
254 (chunk.
preAllocated[originalchunknumber]).isAllocated = 1;
256 return (_Tp*)((chunk.
preAllocated[originalchunknumber]).address);
263 template<
typename _T1,
typename _T2>
272 template<
typename _T1,
typename _T2>
~G4EnhancedVecAllocator()
static G4ThreadLocal G4ChunkIndexType * allocStat
_Tp * allocate(size_t _Count)
static G4ThreadLocal G4int totSpace
G4EnhancedVecAllocator< _Tp1 > other
static G4ThreadLocal G4int numCat
bool operator==(const G4EnhancedVecAllocator< _T1 > &, const G4EnhancedVecAllocator< _T2 > &)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp1 > &)
G4ChunkType * preAllocated
bool operator!=(const G4EnhancedVecAllocator< _T1 > &, const G4EnhancedVecAllocator< _T2 > &)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp > &)
void deallocate(_Tp *_Ptr, size_t _Count)