// This GA will use the resource stack for storage if c_heap==false,
 // Else it will use the C heap.  Use clear_and_deallocate to avoid leaks.
 GenericGrowableArray(int initial_size, int initial_len, bool c_heap) {
   _len = initial_len;
   _max = initial_size;
   assert(_len >= 0 && _len <= _max, "initial_len too big");
   _arena = (c_heap ? (Arena*)1 : NULL);
   set_nesting();
   assert(!c_heap || allocated_on_C_heap(), "growable array must be on C heap if elements are");
 }
Esempio n. 2
0
  // This GA will use the resource stack for storage if c_heap==false,
  // Else it will use the C heap.  Use clear_and_deallocate to avoid leaks.
  GenericGrowableArray(int initial_size, int initial_len, bool c_heap, MEMFLAGS flags = mtNone) {
    _len = initial_len;
    _max = initial_size;
    _memflags = flags;

    // memory type has to be specified for C heap allocation
    assert(!(c_heap && flags == mtNone), "memory type not specified for C heap object");

    assert(_len >= 0 && _len <= _max, "initial_len too big");
    _arena = (c_heap ? (Arena*)1 : NULL);
    set_nesting();
    assert(!on_C_heap() || allocated_on_C_heap(), "growable array must be on C heap if elements are");
    assert(!on_stack() ||
           (allocated_on_res_area() || allocated_on_stack()),
           "growable array must be on stack if elements are not on arena and not on C heap");
  }