انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

lecture 9:compiler II

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم البرامجيات     المرحلة 3
أستاذ المادة حوراء شريف حمزة حسين       27/04/2015 16:56:37
heap management
the heap is the portion of the store that is used for data that lives indefinitely, or until the program explicitly deletings it. while local variables typically become inaccessible when their procedures end, many languages enable us to create objects or other data whose existence is not tied to the procedure activation that creates them. for example, both c++ and java give the programmer new to create objects that may be passed from procedure to procedure, so they continue to exist long after the procedure that created them is gone. such objects are stored on a heap.
allocating memory there are two ways that memory gets allocated for data storage:
1. compile time (or static) allocation
? memory for named variables is allocated by the compiler
? exact size and type of storage must be known at compile time
? for standard array declarations, this is why the size has to be constant
2. dynamic memory allocation
? memory allocated "on the fly" during run time
? dynamically allocated space usually placed in a program segment known as the heap or the free store
? exact amount of space or number of items does not have to be known by the compiler in advance.
? for dynamic memory allocation, pointers are crucial
the memory manager
the memory manager keeps track of all the free space in heap storage at all times. it performs two basic functions:
? allocation. when a program requests memory for a variable or object, the memory manager produces a chunk of contiguous heap memory of the requested size. if possible, it satisfies an allocation request using free space in the heap if no chunk of the needed size is available, it seeks to increase the heap storage space by getting consecutive bytes of virtual memory from the operating system. if space is exhausted, the memory manager passes that information back to the application program.
? deallocation. the memory manager returns deallocated space to the pool of free space, so it can reuse the space to satisfy other allocation requests. memory

المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم