亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? blockpool.c

?? vdhl and matlab, i think it good for you
?? C
字號:
/** \file  This file contains the class functions for a "pool" based memory allocator.  These functions manage the block chain that makes up the memory pool and  allocates memory from the individual blocks.  The entire pool is freed at  once.  This object is independent of the actual memory allocation and  deallocation functions, which are virutal functons. *//*===============================<o>=====================================Copyright 1996, 1997, 2004 Ian Kaplan, Bear Products International,www.bearcave.com.All Rights ReservedYou may use this software in software components for which you donot collect money (e.g., non-commercial software).  All commercialuse is reserved.===============================<o>=====================================*/ #include <assert.h>#include <stdio.h>#include <stdlib.h>#include "stdtypes.h"#include "blockpool.h"block_pool::block_pool(void){    page_size = 0;  alloc_gran = 0;  current_block = NULL;  block_list_start = NULL;} // block_pool constructor/*   This function is automatically called to initialize the block_pool   object when the "current_block" pointer is NULL.*/void block_pool::init_pool( void ){  block_chain *new_link;  getinfo(page_size, alloc_gran);  new_link = new_block( alloc_gran );  block_list_start = new_link;  current_block = new_link;} /* init_pool *//**   Walk through the block chain and deallocate the blocks.   Note that the block chain structures and the allocatible   memory is contained within a single allocated block.   The block_chain structure is at the start of this block   so passing its address to the memory deallocation function   deallocates both the block chain structure and the allocatible   memory*/void block_pool::free_pool(void){  block_chain *tmp;  while (block_list_start != NULL) {    tmp = block_list_start;    block_list_start = Chain_next(block_list_start);    MemFree( (void *)tmp );  }}/**   The new_block function is the "root" memory allocator for the   block_pool object.  The amount of memory allocated is rounded up   to the next "block_size" boundary.  Both the block_chain structure   and the allocatible memory are allocated from a single block   that is a multiple of the page size.  This should avoid fragmentation in   the system memory allocator.*/block_pool::blk_chain *block_pool::new_block( unsigned int block_size ){  const unsigned int max_block_size = max_block_multiple * page_size;  block_chain *new_link = NULL;  unsigned int alloc_amt, total_alloc;  // add in the memory needed for the block_chain structure  total_alloc = block_size + sizeof(block_chain);  if (total_alloc < alloc_gran)      alloc_amt = alloc_gran;  else {       // its larger than the allocation granularity, so round      // up the the nearest page.      alloc_amt = ((total_alloc + (page_size-1))/page_size) * page_size;  }  if (alloc_amt <= max_block_size) {    /* allocate memory for both the block_chain structure and the memory block */    new_link = (block_chain *)MemAlloc( alloc_amt );    // The new memory block starts after the block_chain structure    Chain_block(new_link) = (void *)(((unsigned int)new_link) + sizeof(block_chain));    assert( alloc_amt >= block_size );    Chain_bytes_used(new_link) = 0;    Chain_block_size(new_link) = alloc_amt - sizeof(block_chain);    Chain_next(new_link) = NULL;  }  else {    printf("block_pool::new_block: allocation request too large\n");  }  return new_link;} // block_chain::new_block/**   Add a new memory block to the memory pool.  This function is called when the    amount of memory requested by pool_alloc will not fit in the current block.  */void *block_pool::add_block( unsigned int block_size ){  block_chain *block = NULL;  block_chain *last_block;  last_block = current_block;  block = new_block( block_size );  Chain_next(current_block) = block;  current_block = block;  return (void *)block;} // block_chain::add_block/**   This function is called to allocate memory from the  memory pool.  If there    is enough free memory in the current block to satisify the memory request,    memory is allocated from the current block and the amount of free memory    is updated.  If the current block does not have enough memory, add_block    is called to allocate a new memory block which will be large enough.*/void *block_pool::pool_alloc( unsigned int num_bytes ){  const unsigned int align = sizeof( int );  void *addr = NULL;  unsigned int amt_free;  /* the number of bytes allocated must be a multiple of the align     size */  num_bytes = ((num_bytes + (align-1))/align) * align;  if (current_block == NULL) {    init_pool();  }  amt_free = Chain_block_size(current_block) - Chain_bytes_used(current_block);    if (num_bytes > amt_free) {    if (add_block( num_bytes ) != NULL) {      amt_free = Chain_block_size(current_block);    }  }  if (amt_free >= num_bytes) {    addr = (void *)((unsigned int)Chain_block(current_block) + Chain_bytes_used(current_block));    Chain_bytes_used(current_block) += num_bytes;  }  else {    printf("block_pool::block_alloc: allocation error\n");    exit(1);  }  return addr;} // block_pool::pool_alloc/**   Print information about the block pool*/void block_pool::print_block_pool_info( FILE *fp /*= stdout */){  int total_allocated = 0;  int total_unused = 0;  block_chain *ptr = block_list_start;  fprintf(fp, "[block size, bytes_used]\n");  while (ptr != NULL) {    fprintf(fp, "[%4d, %4d]", Chain_block_size(ptr), Chain_bytes_used(ptr));    total_allocated += Chain_bytes_used(ptr);    total_unused += (Chain_block_size(ptr) - Chain_bytes_used(ptr));    if (Chain_next(ptr) != NULL) {      fprintf(fp, ", ");    }    else {      fprintf(fp, "\n");    }    ptr = Chain_next(ptr);  } // while  fprintf(fp, "Total allocated = %5d, total unused = %3d\n", total_allocated,	 total_unused );}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久99| 日本丶国产丶欧美色综合| 欧美亚一区二区| 国产精品第四页| 激情深爱一区二区| 欧美日本一区二区| 欧美日韩视频第一区| 中文字幕av在线一区二区三区| 欧美日韩成人一区二区| 51久久夜色精品国产麻豆| 日本aⅴ免费视频一区二区三区 | 秋霞av亚洲一区二区三| 制服丝袜亚洲精品中文字幕| 丝袜国产日韩另类美女| 99久久婷婷国产综合精品| 精品国产凹凸成av人网站| 26uuu国产日韩综合| 美国十次综合导航| 久久综合成人精品亚洲另类欧美| 在线精品视频一区二区三四| 亚洲va欧美va人人爽午夜| 91精品视频网| 欧美在线一区二区| 色先锋aa成人| 91亚洲国产成人精品一区二区三 | 18成人在线视频| 91视频观看免费| 国产成人精品www牛牛影视| 成人欧美一区二区三区小说 | 欧美老肥妇做.爰bbww视频| 蜜桃久久精品一区二区| 亚洲成av人片观看| 亚洲一区二区欧美激情| 日韩一区二区三区观看| 久草热8精品视频在线观看| 国产精品免费av| 4438x亚洲最大成人网| 色综合久久久久久久久久久| eeuss鲁一区二区三区| 午夜视黄欧洲亚洲| 久久―日本道色综合久久| 色一情一乱一乱一91av| 99精品视频在线免费观看| 99久久99精品久久久久久| 成人毛片视频在线观看| 免费在线观看不卡| 美国毛片一区二区| 精久久久久久久久久久| 国内精品久久久久影院一蜜桃| 国内精品久久久久影院一蜜桃| 国产精品99久| 午夜视频一区在线观看| 日韩av中文在线观看| 日本一区二区三区国色天香| 欧美日韩国产精品自在自线| 欧美高清激情brazzers| 91精品久久久久久蜜臀| 精品国产一区二区三区不卡| 国产亚洲婷婷免费| 91精品国产综合久久久久久久 | 17c精品麻豆一区二区免费| 亚洲日本在线a| 国产亲近乱来精品视频| 国产精品毛片无遮挡高清| 亚洲欧洲制服丝袜| 久久精品视频免费| 中文字幕在线观看不卡视频| 亚洲蜜臀av乱码久久精品| 亚洲18色成人| 国产福利一区在线观看| 91视视频在线观看入口直接观看www | 亚洲午夜免费电影| 中文字幕第一区综合| 一区二区三区四区不卡在线| 欧美激情一二三区| 一区二区久久久久久| 免费高清在线视频一区·| 国产精品99久久久久久久女警| 91一区二区在线| 欧美一区二区视频网站| 欧美亚洲动漫制服丝袜| 久久网站最新地址| 日韩美女精品在线| 免费在线观看一区二区三区| 成人精品gif动图一区| 国产精品99久久久| 在线免费一区三区| 久久久一区二区三区| 成人欧美一区二区三区视频网页 | 成人福利电影精品一区二区在线观看| 99re视频这里只有精品| 日韩小视频在线观看专区| 亚洲色图制服丝袜| 久久精品二区亚洲w码| 久久国产综合精品| 91蜜桃婷婷狠狠久久综合9色| 日韩一区二区免费在线观看| 最新国产の精品合集bt伙计| 蜜桃视频在线观看一区| 色综合久久66| 日本一二三四高清不卡| 蜜桃传媒麻豆第一区在线观看| eeuss鲁片一区二区三区| 亚洲精品一区在线观看| 亚洲bdsm女犯bdsm网站| 99精品国产99久久久久久白柏| 欧美mv日韩mv亚洲| 欧美激情一区在线观看| 奇米综合一区二区三区精品视频| 99re66热这里只有精品3直播| 精品久久久久久久久久久院品网| 一区二区三区欧美在线观看| 国产高清精品网站| 精品久久久久久久人人人人传媒| 性做久久久久久免费观看| 色综合天天综合| 91国产免费看| 中文字幕日本不卡| 国产成人在线色| 精品99久久久久久| 美女任你摸久久| 制服丝袜亚洲色图| 日韩av电影一区| 欧美在线不卡一区| 夜夜嗨av一区二区三区网页| 成年人午夜久久久| 国产午夜精品福利| 国产一区二区日韩精品| 91美女片黄在线| 中文字幕中文在线不卡住| 国产成a人亚洲精| 在线视频欧美精品| 亚洲综合精品自拍| 欧美自拍偷拍午夜视频| 亚洲国产一区二区三区| 欧美中文字幕不卡| 亚洲一区电影777| 精品视频一区二区三区免费| 亚洲国产一区二区三区| 91久久人澡人人添人人爽欧美| 亚洲免费观看高清完整版在线观看| 99re这里都是精品| 亚洲免费在线视频一区 二区| 91麻豆国产福利精品| 亚洲精品视频自拍| 国内成+人亚洲+欧美+综合在线| 日韩一区二区三区观看| 国产呦精品一区二区三区网站| 精品日韩成人av| 国产成人三级在线观看| 国产精品人妖ts系列视频| 99热精品一区二区| 亚洲综合一区二区精品导航| 欧美日韩免费观看一区三区| 日韩在线播放一区二区| 欧美大片在线观看| 五月综合激情网| 日韩一区二区三区免费看 | 99视频热这里只有精品免费| 亚洲欧洲国产日韩| 欧美日韩一区在线| 日韩va亚洲va欧美va久久| 精品福利一二区| 成人毛片在线观看| 亚洲二区在线观看| 精品美女在线观看| 97aⅴ精品视频一二三区| 亚洲一区中文在线| 欧美变态tickle挠乳网站| 粉嫩绯色av一区二区在线观看| 亚洲视频在线一区二区| 欧美美女激情18p| 国产成人综合视频| 樱桃国产成人精品视频| 日韩欧美一级片| 99久久久免费精品国产一区二区| 亚洲制服丝袜av| 日韩免费看的电影| 99re这里都是精品| 麻豆成人免费电影| 亚洲欧美日韩在线播放| 91精品国产91久久久久久一区二区| 国产精品自产自拍| 一区二区三区精品视频| 精品国产乱码久久久久久蜜臀 | 欧美一区二区视频网站| 成人av免费在线播放| 午夜精品久久久久久久99水蜜桃| 精品国产凹凸成av人导航| 色视频欧美一区二区三区| 久久66热re国产| 亚洲夂夂婷婷色拍ww47| 久久久久久免费毛片精品| 欧美性受xxxx| 国产一区二区免费视频| 日韩电影免费在线观看网站| 国产精品免费aⅴ片在线观看| 日韩一区二区三区视频在线观看| 色8久久人人97超碰香蕉987| 九九久久精品视频|