Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/memory/allocation.hpp
40950 views
1
/*
2
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_MEMORY_ALLOCATION_HPP
26
#define SHARE_MEMORY_ALLOCATION_HPP
27
28
#include "memory/allStatic.hpp"
29
#include "utilities/globalDefinitions.hpp"
30
#include "utilities/macros.hpp"
31
32
#include <new>
33
34
class outputStream;
35
class Thread;
36
class JavaThread;
37
38
class AllocFailStrategy {
39
public:
40
enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
41
};
42
typedef AllocFailStrategy::AllocFailEnum AllocFailType;
43
44
// The virtual machine must never call one of the implicitly declared
45
// global allocation or deletion functions. (Such calls may result in
46
// link-time or run-time errors.) For convenience and documentation of
47
// intended use, classes in the virtual machine may be derived from one
48
// of the following allocation classes, some of which define allocation
49
// and deletion functions.
50
// Note: std::malloc and std::free should never called directly.
51
52
//
53
// For objects allocated in the resource area (see resourceArea.hpp).
54
// - ResourceObj
55
//
56
// For objects allocated in the C-heap (managed by: free & malloc and tracked with NMT)
57
// - CHeapObj
58
//
59
// For objects allocated on the stack.
60
// - StackObj
61
//
62
// For classes used as name spaces.
63
// - AllStatic
64
//
65
// For classes in Metaspace (class data)
66
// - MetaspaceObj
67
//
68
// The printable subclasses are used for debugging and define virtual
69
// member functions for printing. Classes that avoid allocating the
70
// vtbl entries in the objects should therefore not be the printable
71
// subclasses.
72
//
73
// The following macros and function should be used to allocate memory
74
// directly in the resource area or in the C-heap, The _OBJ variants
75
// of the NEW/FREE_C_HEAP macros are used for alloc/dealloc simple
76
// objects which are not inherited from CHeapObj, note constructor and
77
// destructor are not called. The preferable way to allocate objects
78
// is using the new operator.
79
//
80
// WARNING: The array variant must only be used for a homogenous array
81
// where all objects are of the exact type specified. If subtypes are
82
// stored in the array then must pay attention to calling destructors
83
// at needed.
84
//
85
// NEW_RESOURCE_ARRAY*
86
// REALLOC_RESOURCE_ARRAY*
87
// FREE_RESOURCE_ARRAY*
88
// NEW_RESOURCE_OBJ*
89
// NEW_C_HEAP_ARRAY*
90
// REALLOC_C_HEAP_ARRAY*
91
// FREE_C_HEAP_ARRAY*
92
// NEW_C_HEAP_OBJ*
93
// FREE_C_HEAP_OBJ
94
//
95
// char* AllocateHeap(size_t size, MEMFLAGS flags, const NativeCallStack& stack, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
96
// char* AllocateHeap(size_t size, MEMFLAGS flags, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
97
// char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
98
// void FreeHeap(void* p);
99
//
100
// In non product mode we introduce a super class for all allocation classes
101
// that supports printing.
102
// We avoid the superclass in product mode to save space.
103
104
#ifdef PRODUCT
105
#define ALLOCATION_SUPER_CLASS_SPEC
106
#else
107
#define ALLOCATION_SUPER_CLASS_SPEC : public AllocatedObj
108
class AllocatedObj {
109
public:
110
// Printing support
111
void print() const;
112
void print_value() const;
113
114
virtual void print_on(outputStream* st) const;
115
virtual void print_value_on(outputStream* st) const;
116
};
117
#endif
118
119
#define MEMORY_TYPES_DO(f) \
120
/* Memory type by sub systems. It occupies lower byte. */ \
121
f(mtJavaHeap, "Java Heap") /* Java heap */ \
122
f(mtClass, "Class") /* Java classes */ \
123
f(mtThread, "Thread") /* thread objects */ \
124
f(mtThreadStack, "Thread Stack") \
125
f(mtCode, "Code") /* generated code */ \
126
f(mtGC, "GC") \
127
f(mtCompiler, "Compiler") \
128
f(mtJVMCI, "JVMCI") \
129
f(mtInternal, "Internal") /* memory used by VM, but does not belong to */ \
130
/* any of above categories, and not used by */ \
131
/* NMT */ \
132
f(mtOther, "Other") /* memory not used by VM */ \
133
f(mtSymbol, "Symbol") \
134
f(mtNMT, "Native Memory Tracking") /* memory used by NMT */ \
135
f(mtClassShared, "Shared class space") /* class data sharing */ \
136
f(mtChunk, "Arena Chunk") /* chunk that holds content of arenas */ \
137
f(mtTest, "Test") /* Test type for verifying NMT */ \
138
f(mtTracing, "Tracing") \
139
f(mtLogging, "Logging") \
140
f(mtStatistics, "Statistics") \
141
f(mtArguments, "Arguments") \
142
f(mtModule, "Module") \
143
f(mtSafepoint, "Safepoint") \
144
f(mtSynchronizer, "Synchronization") \
145
f(mtServiceability, "Serviceability") \
146
f(mtMetaspace, "Metaspace") \
147
f(mtStringDedup, "String Deduplication") \
148
f(mtNone, "Unknown") \
149
//end
150
151
#define MEMORY_TYPE_DECLARE_ENUM(type, human_readable) \
152
type,
153
154
/*
155
* Memory types
156
*/
157
enum class MEMFLAGS {
158
MEMORY_TYPES_DO(MEMORY_TYPE_DECLARE_ENUM)
159
mt_number_of_types // number of memory types (mtDontTrack
160
// is not included as validate type)
161
};
162
163
#define MEMORY_TYPE_SHORTNAME(type, human_readable) \
164
constexpr MEMFLAGS type = MEMFLAGS::type;
165
166
// Generate short aliases for the enum values. E.g. mtGC instead of MEMFLAGS::mtGC.
167
MEMORY_TYPES_DO(MEMORY_TYPE_SHORTNAME)
168
169
// Make an int version of the sentinel end value.
170
constexpr int mt_number_of_types = static_cast<int>(MEMFLAGS::mt_number_of_types);
171
172
#if INCLUDE_NMT
173
174
extern bool NMT_track_callsite;
175
176
#else
177
178
const bool NMT_track_callsite = false;
179
180
#endif // INCLUDE_NMT
181
182
class NativeCallStack;
183
184
185
char* AllocateHeap(size_t size,
186
MEMFLAGS flags,
187
const NativeCallStack& stack,
188
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
189
char* AllocateHeap(size_t size,
190
MEMFLAGS flags,
191
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
192
193
char* ReallocateHeap(char *old,
194
size_t size,
195
MEMFLAGS flag,
196
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
197
198
// handles NULL pointers
199
void FreeHeap(void* p);
200
201
template <MEMFLAGS F> class CHeapObj ALLOCATION_SUPER_CLASS_SPEC {
202
public:
203
ALWAYSINLINE void* operator new(size_t size) throw() {
204
return (void*)AllocateHeap(size, F);
205
}
206
207
ALWAYSINLINE void* operator new(size_t size,
208
const NativeCallStack& stack) throw() {
209
return (void*)AllocateHeap(size, F, stack);
210
}
211
212
ALWAYSINLINE void* operator new(size_t size, const std::nothrow_t&,
213
const NativeCallStack& stack) throw() {
214
return (void*)AllocateHeap(size, F, stack, AllocFailStrategy::RETURN_NULL);
215
}
216
217
ALWAYSINLINE void* operator new(size_t size, const std::nothrow_t&) throw() {
218
return (void*)AllocateHeap(size, F, AllocFailStrategy::RETURN_NULL);
219
}
220
221
ALWAYSINLINE void* operator new[](size_t size) throw() {
222
return (void*)AllocateHeap(size, F);
223
}
224
225
ALWAYSINLINE void* operator new[](size_t size,
226
const NativeCallStack& stack) throw() {
227
return (void*)AllocateHeap(size, F, stack);
228
}
229
230
ALWAYSINLINE void* operator new[](size_t size, const std::nothrow_t&,
231
const NativeCallStack& stack) throw() {
232
return (void*)AllocateHeap(size, F, stack, AllocFailStrategy::RETURN_NULL);
233
}
234
235
ALWAYSINLINE void* operator new[](size_t size, const std::nothrow_t&) throw() {
236
return (void*)AllocateHeap(size, F, AllocFailStrategy::RETURN_NULL);
237
}
238
239
void operator delete(void* p) { FreeHeap(p); }
240
void operator delete [] (void* p) { FreeHeap(p); }
241
};
242
243
// Base class for objects allocated on the stack only.
244
// Calling new or delete will result in fatal error.
245
246
class StackObj ALLOCATION_SUPER_CLASS_SPEC {
247
private:
248
void* operator new(size_t size) throw();
249
void* operator new [](size_t size) throw();
250
void operator delete(void* p);
251
void operator delete [](void* p);
252
};
253
254
// Base class for objects stored in Metaspace.
255
// Calling delete will result in fatal error.
256
//
257
// Do not inherit from something with a vptr because this class does
258
// not introduce one. This class is used to allocate both shared read-only
259
// and shared read-write classes.
260
//
261
262
class ClassLoaderData;
263
class MetaspaceClosure;
264
265
class MetaspaceObj {
266
friend class VMStructs;
267
// When CDS is enabled, all shared metaspace objects are mapped
268
// into a single contiguous memory block, so we can use these
269
// two pointers to quickly determine if something is in the
270
// shared metaspace.
271
// When CDS is not enabled, both pointers are set to NULL.
272
static void* _shared_metaspace_base; // (inclusive) low address
273
static void* _shared_metaspace_top; // (exclusive) high address
274
275
public:
276
277
// Returns true if the pointer points to a valid MetaspaceObj. A valid
278
// MetaspaceObj is MetaWord-aligned and contained within either
279
// non-shared or shared metaspace.
280
static bool is_valid(const MetaspaceObj* p);
281
282
static bool is_shared(const MetaspaceObj* p) {
283
// If no shared metaspace regions are mapped, _shared_metaspace_{base,top} will
284
// both be NULL and all values of p will be rejected quickly.
285
return (((void*)p) < _shared_metaspace_top &&
286
((void*)p) >= _shared_metaspace_base);
287
}
288
bool is_shared() const { return MetaspaceObj::is_shared(this); }
289
290
void print_address_on(outputStream* st) const; // nonvirtual address printing
291
292
static void set_shared_metaspace_range(void* base, void* top) {
293
_shared_metaspace_base = base;
294
_shared_metaspace_top = top;
295
}
296
297
static void* shared_metaspace_base() { return _shared_metaspace_base; }
298
static void* shared_metaspace_top() { return _shared_metaspace_top; }
299
300
#define METASPACE_OBJ_TYPES_DO(f) \
301
f(Class) \
302
f(Symbol) \
303
f(TypeArrayU1) \
304
f(TypeArrayU2) \
305
f(TypeArrayU4) \
306
f(TypeArrayU8) \
307
f(TypeArrayOther) \
308
f(Method) \
309
f(ConstMethod) \
310
f(MethodData) \
311
f(ConstantPool) \
312
f(ConstantPoolCache) \
313
f(Annotations) \
314
f(MethodCounters) \
315
f(RecordComponent)
316
317
#define METASPACE_OBJ_TYPE_DECLARE(name) name ## Type,
318
#define METASPACE_OBJ_TYPE_NAME_CASE(name) case name ## Type: return #name;
319
320
enum Type {
321
// Types are MetaspaceObj::ClassType, MetaspaceObj::SymbolType, etc
322
METASPACE_OBJ_TYPES_DO(METASPACE_OBJ_TYPE_DECLARE)
323
_number_of_types
324
};
325
326
static const char * type_name(Type type) {
327
switch(type) {
328
METASPACE_OBJ_TYPES_DO(METASPACE_OBJ_TYPE_NAME_CASE)
329
default:
330
ShouldNotReachHere();
331
return NULL;
332
}
333
}
334
335
static MetaspaceObj::Type array_type(size_t elem_size) {
336
switch (elem_size) {
337
case 1: return TypeArrayU1Type;
338
case 2: return TypeArrayU2Type;
339
case 4: return TypeArrayU4Type;
340
case 8: return TypeArrayU8Type;
341
default:
342
return TypeArrayOtherType;
343
}
344
}
345
346
void* operator new(size_t size, ClassLoaderData* loader_data,
347
size_t word_size,
348
Type type, JavaThread* thread) throw();
349
// can't use TRAPS from this header file.
350
void* operator new(size_t size, ClassLoaderData* loader_data,
351
size_t word_size,
352
Type type) throw();
353
void operator delete(void* p) { ShouldNotCallThis(); }
354
355
// Declare a *static* method with the same signature in any subclass of MetaspaceObj
356
// that should be read-only by default. See symbol.hpp for an example. This function
357
// is used by the templates in metaspaceClosure.hpp
358
static bool is_read_only_by_default() { return false; }
359
};
360
361
// Base class for classes that constitute name spaces.
362
363
class Arena;
364
365
extern char* resource_allocate_bytes(size_t size,
366
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
367
extern char* resource_allocate_bytes(Thread* thread, size_t size,
368
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
369
extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size,
370
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
371
extern void resource_free_bytes( char *old, size_t size );
372
373
//----------------------------------------------------------------------
374
// Base class for objects allocated in the resource area per default.
375
// Optionally, objects may be allocated on the C heap with
376
// new(ResourceObj::C_HEAP) Foo(...) or in an Arena with new (&arena)
377
// ResourceObj's can be allocated within other objects, but don't use
378
// new or delete (allocation_type is unknown). If new is used to allocate,
379
// use delete to deallocate.
380
class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
381
public:
382
enum allocation_type { STACK_OR_EMBEDDED = 0, RESOURCE_AREA, C_HEAP, ARENA, allocation_mask = 0x3 };
383
static void set_allocation_type(address res, allocation_type type) NOT_DEBUG_RETURN;
384
#ifdef ASSERT
385
private:
386
// When this object is allocated on stack the new() operator is not
387
// called but garbage on stack may look like a valid allocation_type.
388
// Store negated 'this' pointer when new() is called to distinguish cases.
389
// Use second array's element for verification value to distinguish garbage.
390
uintptr_t _allocation_t[2];
391
bool is_type_set() const;
392
void initialize_allocation_info();
393
public:
394
allocation_type get_allocation_type() const;
395
bool allocated_on_stack() const { return get_allocation_type() == STACK_OR_EMBEDDED; }
396
bool allocated_on_res_area() const { return get_allocation_type() == RESOURCE_AREA; }
397
bool allocated_on_C_heap() const { return get_allocation_type() == C_HEAP; }
398
bool allocated_on_arena() const { return get_allocation_type() == ARENA; }
399
protected:
400
ResourceObj(); // default constructor
401
ResourceObj(const ResourceObj& r); // default copy constructor
402
ResourceObj& operator=(const ResourceObj& r); // default copy assignment
403
~ResourceObj();
404
#endif // ASSERT
405
406
public:
407
void* operator new(size_t size, allocation_type type, MEMFLAGS flags) throw();
408
void* operator new [](size_t size, allocation_type type, MEMFLAGS flags) throw();
409
void* operator new(size_t size, const std::nothrow_t& nothrow_constant,
410
allocation_type type, MEMFLAGS flags) throw();
411
void* operator new [](size_t size, const std::nothrow_t& nothrow_constant,
412
allocation_type type, MEMFLAGS flags) throw();
413
414
void* operator new(size_t size, Arena *arena) throw();
415
416
void* operator new [](size_t size, Arena *arena) throw();
417
418
void* operator new(size_t size) throw() {
419
address res = (address)resource_allocate_bytes(size);
420
DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
421
return res;
422
}
423
424
void* operator new(size_t size, const std::nothrow_t& nothrow_constant) throw() {
425
address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL);
426
DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);)
427
return res;
428
}
429
430
void* operator new [](size_t size) throw() {
431
address res = (address)resource_allocate_bytes(size);
432
DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
433
return res;
434
}
435
436
void* operator new [](size_t size, const std::nothrow_t& nothrow_constant) throw() {
437
address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL);
438
DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);)
439
return res;
440
}
441
442
void operator delete(void* p);
443
void operator delete [](void* p);
444
};
445
446
// One of the following macros must be used when allocating an array
447
// or object to determine whether it should reside in the C heap on in
448
// the resource area.
449
450
#define NEW_RESOURCE_ARRAY(type, size)\
451
(type*) resource_allocate_bytes((size) * sizeof(type))
452
453
#define NEW_RESOURCE_ARRAY_RETURN_NULL(type, size)\
454
(type*) resource_allocate_bytes((size) * sizeof(type), AllocFailStrategy::RETURN_NULL)
455
456
#define NEW_RESOURCE_ARRAY_IN_THREAD(thread, type, size)\
457
(type*) resource_allocate_bytes(thread, (size) * sizeof(type))
458
459
#define NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_NULL(thread, type, size)\
460
(type*) resource_allocate_bytes(thread, (size) * sizeof(type), AllocFailStrategy::RETURN_NULL)
461
462
#define REALLOC_RESOURCE_ARRAY(type, old, old_size, new_size)\
463
(type*) resource_reallocate_bytes((char*)(old), (old_size) * sizeof(type), (new_size) * sizeof(type))
464
465
#define REALLOC_RESOURCE_ARRAY_RETURN_NULL(type, old, old_size, new_size)\
466
(type*) resource_reallocate_bytes((char*)(old), (old_size) * sizeof(type),\
467
(new_size) * sizeof(type), AllocFailStrategy::RETURN_NULL)
468
469
#define FREE_RESOURCE_ARRAY(type, old, size)\
470
resource_free_bytes((char*)(old), (size) * sizeof(type))
471
472
#define FREE_FAST(old)\
473
/* nop */
474
475
#define NEW_RESOURCE_OBJ(type)\
476
NEW_RESOURCE_ARRAY(type, 1)
477
478
#define NEW_RESOURCE_OBJ_RETURN_NULL(type)\
479
NEW_RESOURCE_ARRAY_RETURN_NULL(type, 1)
480
481
#define NEW_C_HEAP_ARRAY3(type, size, memflags, pc, allocfail)\
482
(type*) AllocateHeap((size) * sizeof(type), memflags, pc, allocfail)
483
484
#define NEW_C_HEAP_ARRAY2(type, size, memflags, pc)\
485
(type*) (AllocateHeap((size) * sizeof(type), memflags, pc))
486
487
#define NEW_C_HEAP_ARRAY(type, size, memflags)\
488
(type*) (AllocateHeap((size) * sizeof(type), memflags))
489
490
#define NEW_C_HEAP_ARRAY2_RETURN_NULL(type, size, memflags, pc)\
491
NEW_C_HEAP_ARRAY3(type, (size), memflags, pc, AllocFailStrategy::RETURN_NULL)
492
493
#define NEW_C_HEAP_ARRAY_RETURN_NULL(type, size, memflags)\
494
NEW_C_HEAP_ARRAY2(type, (size), memflags, AllocFailStrategy::RETURN_NULL)
495
496
#define REALLOC_C_HEAP_ARRAY(type, old, size, memflags)\
497
(type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags))
498
499
#define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\
500
(type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL))
501
502
#define FREE_C_HEAP_ARRAY(type, old) \
503
FreeHeap((char*)(old))
504
505
// allocate type in heap without calling ctor
506
#define NEW_C_HEAP_OBJ(type, memflags)\
507
NEW_C_HEAP_ARRAY(type, 1, memflags)
508
509
#define NEW_C_HEAP_OBJ_RETURN_NULL(type, memflags)\
510
NEW_C_HEAP_ARRAY_RETURN_NULL(type, 1, memflags)
511
512
// deallocate obj of type in heap without calling dtor
513
#define FREE_C_HEAP_OBJ(objname)\
514
FreeHeap((char*)objname);
515
516
517
//------------------------------ReallocMark---------------------------------
518
// Code which uses REALLOC_RESOURCE_ARRAY should check an associated
519
// ReallocMark, which is declared in the same scope as the reallocated
520
// pointer. Any operation that could __potentially__ cause a reallocation
521
// should check the ReallocMark.
522
class ReallocMark: public StackObj {
523
protected:
524
NOT_PRODUCT(int _nesting;)
525
526
public:
527
ReallocMark() PRODUCT_RETURN;
528
void check() PRODUCT_RETURN;
529
};
530
531
// Helper class to allocate arrays that may become large.
532
// Uses the OS malloc for allocations smaller than ArrayAllocatorMallocLimit
533
// and uses mapped memory for larger allocations.
534
// Most OS mallocs do something similar but Solaris malloc does not revert
535
// to mapped memory for large allocations. By default ArrayAllocatorMallocLimit
536
// is set so that we always use malloc except for Solaris where we set the
537
// limit to get mapped memory.
538
template <class E>
539
class ArrayAllocator : public AllStatic {
540
private:
541
static bool should_use_malloc(size_t length);
542
543
static E* allocate_malloc(size_t length, MEMFLAGS flags);
544
static E* allocate_mmap(size_t length, MEMFLAGS flags);
545
546
static void free_malloc(E* addr, size_t length);
547
static void free_mmap(E* addr, size_t length);
548
549
public:
550
static E* allocate(size_t length, MEMFLAGS flags);
551
static E* reallocate(E* old_addr, size_t old_length, size_t new_length, MEMFLAGS flags);
552
static void free(E* addr, size_t length);
553
};
554
555
// Uses mmaped memory for all allocations. All allocations are initially
556
// zero-filled. No pre-touching.
557
template <class E>
558
class MmapArrayAllocator : public AllStatic {
559
private:
560
static size_t size_for(size_t length);
561
562
public:
563
static E* allocate_or_null(size_t length, MEMFLAGS flags);
564
static E* allocate(size_t length, MEMFLAGS flags);
565
static void free(E* addr, size_t length);
566
};
567
568
// Uses malloc:ed memory for all allocations.
569
template <class E>
570
class MallocArrayAllocator : public AllStatic {
571
public:
572
static size_t size_for(size_t length);
573
574
static E* allocate(size_t length, MEMFLAGS flags);
575
static void free(E* addr);
576
};
577
578
#endif // SHARE_MEMORY_ALLOCATION_HPP
579
580