I am trying to dynamically allocate a large array in Ada (well, an array of an array). For instance, I'm able to dynamically allocate an object like so:
type Object;
type ObjPtr is access Object;
OP : ObjPtr;
-- sometime later
OP := new Object;
OP.Index := I;--OP.Ptr.all;
Free(OP);
I'm trying to emulate this benchmark code:
Object **objList = new Object*[500000];
int32_t *iList = new int32_t[500000];
for (int32_t i = 0; i < 500000; ++i)
{
objList[i] = new Object;
iList[i] = Object::getIndex(objList[i]);
delete objList[i];
}
delete[] iList;
delete[] objList;
Sadly, I'm unable to even do something like this c++ equivalent:
Object *objList = new Object*[500000];
I came up with this much so far:
type objs is array (Positive range <>) of Object;
type objList is access objs;
But I'm probably way off.