Home > AS/400 Tips > iSeries administrator tips > Ten important things to remember about heaps
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Ten important things to remember about heaps


Ron Turull
12.01.1999
Rating: -4.75- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Memory for dynamic variables is allocated off an internal structure called the "heap." The heap is simply a chunk of memory that the system allocates for an activation group when the activation group is created.

The Alloc, Dealloc, and Realloc op-codes are pretty straight-forward once you understand a few things about heaps.

  1. First, a heap is tied to, or scoped to, the activation group in which it was created. Each activation group has one heap called the default heap. The default heap is created automatically when the associated activation group is created. A program can also create additional heaps called user-created heaps using APIs.

  2. Heaps have an identifier. Since there can be multiple heaps in an activation group, heaps have an ID in order to uniquely identifier them. Many calls to dynamic memory management APIs require a heap identifier parameter to distinguish the heap on which the API is to act. The default heap in each activation group always has an identifier of 0 (zero).
  3. The RPG dynamic memory op-codes always operate on the default heap, so no identifier is necessary.
  4. Heaps are "owned" by the activation group in which they are created. When an activation group ends, all the heaps it owns are discarded.
  5. A heap's unique identifier is meaningful only within the activation group that owns the heap.
  6. Programs can manually create and discard additional heaps to satisfy unique storage requirements. User-created heaps can be created using the CEECRHP API and discarded with the CEEDSHP API. However, they can only be accessed using certain APIs.
  7. Heaps are created with a fixed size. The size is extended automatically to satisfy allocation requests.
  8. The maximum size for a heap is just under 4 GB provided there are not more than 128,000 individual allocations at a given time. The maximum size decreases in the off-chance the maximum number of allocations is exceeded.
  9. The maximum number of bytes for any allocation is limited to just under 16 MB.
  10. Programs in different activation groups can share the same heap. For example, a program can allocate a block of memory off it's default heap, then call another program that runs in a different activation group. If the first program passes a pointer to the allocated heap memory to the second program, the second program has full access to the heap in the activation in which the first program is running. It can access the memory as usual, and it can use the Realloc and Dealloc op-codes against it.

  11. Rate this Tip
    To rate tips, you must be a member of Search400.com.
    Register now to start rating these tips. Log in if you are already a member.


    Submit a Tip




    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



    RELATED CONTENT
    iSeries administrator tips
    Analyze the health of your IBM i server with iScore
    Researching high availability for your System i shop
    Translating Linux for IBM i admins: Using GUI to make it easy
    Translating Linux for IBM i admins: Working with jobs and networking
    OpenOffice: What to know before making the transition from Microsoft Office
    OpenOffice: An enterprise open source solution
    Database performance comparisons on IBM i
    Translating Linux for IBM i admins: User profile commands
    Modern System i reports using Client Access
    Tips for installing Lotus Domino server on a System i partition

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary

    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts