Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

What are program segments, and which segments are different types of variables stored in?

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

Note: 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:

Note: 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, e.g., mpxlf77).
    • A regular array is in the stack region when compiled with xlf90 (and variants thereof, e.g., 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, to learn more about program segments, email the High Performance Applications group, or see the High Performance Applications web page.

This document was developed with support from the National Science Foundation (NSF) under Grant No. 0503697 to the University of Chicago and subcontracted to Indiana University. Additional support was provided by IU through its participation in the TeraGrid, which is supported by the NSF under Grants No. 0833618, SCI451237, SCI535258, and SCI504075. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.

This document was developed with support from National Science Foundation (NSF) grant OCI-1053575. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.

This is document areb in domains all, tgrid-all, and xsede-all.
Last modified on September 07, 2011.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.