Skip to content
Snippets Groups Projects
Select Git revision
  • e78baab579f051cbb9f2c26dc07878fe4ce6d949
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

commande.class.php

Blame
  • mm.c 18.46 KiB
    /* 
     * mm.c  -  Simple allocator based on explicit free lists and 
     *         	first fit placement. It uses boundary tags and
     * 			a circular doubly linked list to keep track of
     * 			free blocks.
     *
     * Each block has a header and footer of the form:
     * 
     *      31                     3  2  1  0 
     *      -----------------------------------
     *     | s  s  s  s  ... s  s  s  0  0  a/f
     *      ----------------------------------- 
     * 
     * where s are the meaningful size bits and a/f is set iff the
     * block is allocated (0=a/1=f). Every block follows the form:
     * 
     *      31             0
     *      ----------------
     *     | Header
     *      ------------------
     *     | prev_free_block  \
     *      ----------------   | - Payload when not free
     *     | next_free_block  /
     *      ------------------
     *     | Footer
     *      ----------------
     * 
     * Due to the size of the header and the bytes required to store
     * the next and previous pointers, the minsize of a free block MUST
     * be 4 words, or 2 DWORDS (16 bytes)
     * 
     * The list has the following form:
     *
     * begin                                                         end
     * heap                                                          heap  
     *  -----------------------------------------------------------------   
     * |  key   | hdr(8:a) |   pad   | zero or more usr blks | hdr(8:a) |
     *  -----------------------------------------------------------------
     *    four  | prologue |  four   |                       | epilogue |
     *    bytes | block    |  bytes  |                       | block    |
     *
     */
    
    #include <stdio.h>
    #include <unistd.h>
    #include <string.h>
    #include <stdlib.h>
    #include "mm.h"
    #include "memlib.h"
    
    
    /* Team structure */
    team_t team = {
    	/* Team name */
    	"Daniel Shchur",
    	/* Full name */
    	"Daniel Shchur",
    	/* Email address */
    	"daniel.shchur@huskers.unl.edu",
    	"",""
    };
    
    
    /* $begin mallocmacros */
    /* Basic constants and macros */
    
    /* You can add more macros and constants in this section */
    #define WSIZE       4       /* word size (bytes) */  
    #define DSIZE       8       /* doubleword size (bytes) */
    #define CHUNKSIZE  (1<<12)  /* initial heap size (bytes) */