About program segments

Memory within a computer is typically made of different portions of memory with specialized attributes called segments.

Program segments are different from the notion of segmented memory.

If you have a Fortran or C program, depending on a number of factors, different segments are used to store your variables (data). Following is a list of common variable types and the segments in which they are stored (some of the information below is compiler-specific):

  • Fortran code:
    • A regular Fortran 77 array is in the data region when compiling with xlf77 (and variants thereof, for example, mpxlf77).
    • A regular array is in the stack region when compiled with xlf90 (and variants thereof, for example, mpxlf90), unless the array appears in a SAVE statement or a COMMON block, or the -qsave option is used.
    • A Fortran 90 allocatable array is in the data region.
    • A Fortran 90 automatic array is in the stack region.
  • C/C++ code:
    • Static C data is in the data region.
    • Automatic C data is in the stack region.
    • C data allocated through malloc is in the data region.

At Indiana University, if you have a question about program segments, contact the UITS Research Applications and Deep Learning team.

This is document areb in the Knowledge Base.
Last modified on 2019-04-05 14:45:53.