Dope Vector

Dope Vectors is a data structure that is used by compilers to store some metadata about the array like its total size, the size of one unit also called stride of the array, etc. These are used to describe arrays and other similar structures that store multiple values of one datatype as a complete block of memory. It can also describe structures that contain arrays and similar structures as its component. Dope vectors help compilers to access the arrays with ease. Different checks that are implemented by compiler like Out of Bound check,datatype check,etc. are all possible because of dope vector associated with the array.
The following details are stored in the dope vector for a particular array:

  • E denotes the size of one single array element like E = 1 for character, E = 4 for integers, etc.
  • VO denotes the virtual starting memory of the array inside the RAM.
  • LU1 denotes the starting lower bound of the array.
  • UB1 denotes the upper limit up to which the array is currently occupied.
  • UB2 denotes the upper limit up to which the array can be filled.

The details that a dope vector stores vary from one operating system to another, but mostly it contains the following information regarding an array:

  • Rank or number of dimensions of array or
  • The base address of the array.
  • The type of elements stored in the array.
  • The stride of the array.
  • The extent of the array.

and many other details.
There are many problems that are solved by using the concept of dope vectors with the arrays at the cost of a small computation overhead (fetching data from dope vector) like:

  • It is difficult to release the extra memory associated with the array without the use of dope vector. Suppose that we initially allocated 200KB of memory for the array. But when it was used it required only 150 Kb of memory. Releasing the extra memory becomes quite easy with the use of dope vector as it store the extent of the memory currently occupied by the array.
  • Without the dope vectors it is very difficult to determine the number of elements int the array, since it stores the information of the total size of the array and the length of the stride. It can be used to calculate the total number of elements in the array.


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.