8-4-Storage Crunch-Dynamic storage Management-8th chapter-Data structure textbook source code-Min 聯繫 version

Source: Internet
Author: User

Textbook Source Code section

Chapter 8th Dynamic Storage Management- storage tightening

--"Data structure"-Min. 聯繫 version

Source code Use instructions link??? data Structure-C language edition (Min, 聯繫 version) textbook source + problem sets analysis using instructions

Textbook source Collection link??? "Data structure" textbook source code compilation

Problem sets full parse link??? analysis of the problem of the data structure problems in the compilation

Source code introduced by the file link? Status.h

relevant test data download link? Data Package

document source code and test data storage directory: Data structure \▲ textbook algorithm implementation \▲08 dynamic storage Management \04 storagecompacting

Overview

"Storage Crunch" is a dynamic storage management method for the "heap" structure.

Throughout the dynamic storage process, the available space is a contiguous store of addresses at any point in time, and is called a "heap" in the compiler, with each allocation being a piece of the available space. The way to do this is to set up a pointer, called the heap pointers, that always points to the lowest (or highest) address of the heap. When a user requests a storage block of n units, the heap pointer calls the N storage units to the high address (or low address), and the value of the heap pointer before moving is the initial address of the occupied block assigned to the user.

Conversely, when it is necessary to reclaim free blocks freed by the user, since the system can always use space as an address for continuous storage, it must be reclaimed by merging the freed blocks into the entire heap to be reused, which is the "Storage Crunch" task.

parsing

There are usually two approaches to storage tightening, one is the recovery crunch once a user frees the block, and the other is to not reclaim the storage block that the user releases at any time during the execution of the program until the storage crunch can be made with insufficient space allocated or the heap pointer pointing to the highest address. The purpose of this tightening is to link all the blocks of space in the heap to the lower address area of the available space, and the remaining high address area to become an entire contiguous block of empty addresses.

Source Code file one? StorageCompacting.h

file two? storagecompacting.c

file three? storagecompacting-main.c (test document)

test results show

more chapters in the Continuous update ...

8-4-Storage Crunch-Dynamic storage Management-8th chapter-Data structure textbook source code-Min 聯繫 version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.