1 Aug 2006 04:41
varray semantics
What are the desired semantics of a variable length array? My vague thoughts are: (1) initially empty, with push_back/pop_back functions to add and remove elements from the end (2) reserve_memory(n), reserve_addresses(n), bound(n) (3) lock(n) reserve_memory allocates, or promises to allocate, enough memory for n slots. reserve_addresses reserves address space (using mmap or equivalent) without necessarily promising to reserve storage. bound just sets the maximum possible size of the array, if exceeded the program aborts. lock hints that pages should be locked into memory. When reserved address space is exceeded, one of two things happens: (a) the program aborts (b) the array is reallocated. Reallocation leads to some problems. First, we need(Continue reading)
RSS Feed