00001 /*****************************************************************************\ 00002 * Copyright 1993 The Board of Trustees of the University of Illinois. 00003 * All rights reserved. 00004 * 00005 * l_alloc_new.h, part of the IMPACT memory-allocation manager 00006 * John C. Gyllenhaal, Wen-mei Hwu, and The IMPACT Research Group 00007 * Coordinated Science Laboratory 00008 * University of Illinois at Urbana-Champaign 00009 * 00010 * The IMPACT Research Group may be contacted at impact@crhc.uiuc.edu. 00011 * 00012 * l_alloc_new.h (part of the IMPACT memory-allocation manager), 00013 * including both binary and source (hereafter, Software) is copyrighted by 00014 * The Board of Trustees of the University of Illinois (UI), 00015 * and ownership remains with the UI. 00016 * 00017 * The UI grants you (hereafter, Licensee) a license to use the Software for 00018 * academic, research and internal business purposes only, without a fee. 00019 * Licensee may distribute the Software to third parties provided that the 00020 * copyright notice and this statement appears on all copies and that no 00021 * charge is associated with such copies. 00022 * 00023 * Licensee may make derivative works. However, if Licensee distributes 00024 * any derivative work based on or derived from the Software, then Licensee 00025 * will clearly notify users that such derivative work is a modified 00026 * version and not the original Software distributed by the UI. 00027 * 00028 * Any Licensee wishing to make commercial use of the Software should contact 00029 * the UI, c/o the Research and Technology Management Office [rtmo@uiuc.edu], 00030 * to negotiate an appropriate license for such commercial use. Commercial 00031 * use includes (1) integration of all or part of the source code into a 00032 * product for sale or license by or on behalf of Licensee to third parties, 00033 * or (2) distribution of the Software to third parties that need it to 00034 * utilize a commercial product sold or licensed by or on behalf of Licensee. 00035 * 00036 * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR 00037 * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 00038 * THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USERS OF THIS 00039 * SOFTWARE. 00040 * 00041 * By using or copying this Software, Licensee agrees to abide by the 00042 * copyright law and all other applicable laws of the U.S. including, but 00043 * not limited to, export control laws, and the terms of this license. 00044 * UI shall have the right to terminate this license immediately by written 00045 * notice upon Licensee's breach of, or non-compliance with, any of its terms. 00046 * Licensee may be held legally responsible for any copyright infringement 00047 * that is caused or encouraged by Licensee's failure to abide by the terms 00048 * of this license. 00049 * 00050 * Form approved by University Counsel, M.A.R., 05/10/93 00051 \*****************************************************************************/ 00052 /*=========================================================================== 00053 * 00054 * File : l_alloc_new.h 00055 * Description : New and improved data structure allocation/mgmt 00056 * Creation Date : May 1993 00057 * Authors : John C. Gyllenhaal and Wen-mei Hwu 00058 * Contributors: Roger Bringmann and Scott Mahlke 00059 * 00060 *==========================================================================*/ 00061 #ifndef L_ALLOC_NEW_H 00062 #define L_ALLOC_NEW_H 00063 00064 #include <stdio.h> 00065 00066 typedef struct L_Alloc_Pool_Header 00067 { 00068 struct L_Alloc_Pool_Header *next; 00069 } L_Alloc_Pool_Header; 00070 00071 typedef struct L_Alloc_Pool 00072 { 00073 char *name; 00074 int element_size; 00075 int block_size; /* Block size to allocate */ 00076 int num_in_block;/* Num elements in block */ 00077 struct L_Alloc_Pool_Header *head; /* Pointer to head of free list*/ 00078 int allocated; /* Number allocated */ 00079 int free; /* Number free */ 00080 int blocks_allocated; 00081 struct L_Alloc_Pool_Header *block_list; /* Pointer to blocks allocated */ 00082 int bypass_routines; 00083 } L_Alloc_Pool; 00084 00085 00086 /* Prototypes */ 00087 #ifdef __cplusplus 00088 extern "C" { 00089 #endif 00090 00091 extern L_Alloc_Pool *L_create_alloc_pool (char *, int, int); 00092 /* (char *name, int size, int num_in_block) */ 00093 extern void L_free_alloc_pool (L_Alloc_Pool *); 00094 /* (L_Alloc_Pool *pool) */ 00095 00096 extern void *L_alloc (L_Alloc_Pool *); 00097 /* (L_Alloc_Pool *pool) */ 00098 extern void L_free (L_Alloc_Pool *, void *); 00099 /* (L_Alloc_Pool *pool, void *ptr) */ 00100 extern void L_print_alloc_info(FILE *, L_Alloc_Pool *, int); 00101 /* (FILE *F, L_Alloc_Pool *pool, int verbose) */ 00102 00103 #ifdef __cplusplus 00104 } 00105 #endif 00106 00107 00108 /* 00109 * Set this to 1 before creating an alloc pool to bypass alloc routines 00110 * so that malloc and free are called each time L_alloc and L_free are called 00111 * with that alloc pool. 00112 * This allows efficient use of the debug malloc routines. 00113 */ 00114 00115 #ifdef __cplusplus 00116 extern "C" { 00117 #endif 00118 00119 extern int bypass_alloc_routines; 00120 00121 #ifdef __cplusplus 00122 } 00123 #endif 00124 00125 #endif 00126
1.3.2