Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Data structures and algorithms in Java (6th edition): Chapter 15.2 - Goodrich, Tamassia, Goldwasser
Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG
Tải xuống
This chapter provides knowledge of memory management. Data structures and algorithms in java provides an introduction to data structures and algorithms, including their design, analysis, and implementation. | Memory Management 3/29/14 21:38 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Memory Management Diagram of a 4×4 plane of magnetic core memory in an X/Y line coincident-current setup. By Tetromino. This file is licensed under the Creative Commons Attribution 3.0 Unported license. © 2014 Goodrich, Tamassia, Goldwasser Memory Management 1 Computer Memory q q q q In order to implement any data structure on an actual computer, we need to use computer memory. Computer memory is organized into a sequence of words, each of which typically consists of 4, 8, or 16 bytes (depending on the computer). These memory words are numbered from 0 to N −1, where N is the number of memory words available to the computer. The number associated with each memory word is known as its memory address. © 2014 Goodrich, Tamassia, Goldwasser Memory Management 2 1 Memory Management 3/29/14 21:38 Object Creation q q q With Python, all objects are stored in a pool of memory, known as the memory heap or Python heap (which should not be confused with the “heap” data structure). Consider what happens when we execute a command such as: w = Widget() A new instance of the class is created and stored somewhere within the memory heap. © 2014 Goodrich, Tamassia, Goldwasser Memory Management 3 Free List q q q q The storage available in the memory heap is divided into blocks, which are contiguous array-like “chunks” of memory that may be of variable or fixed sizes. The system must be implemented so that it can quickly allocate memory for new objects. One popular method is to keep contiguous “holes” of available free memory in a linked list, called the free list. Deciding how to allocate blocks of memory from the free list when a request is made is known as memory management. © 2014 Goodrich, Tamassia, Goldwasser Memory Management 4 2 Memory