| 订阅 | 在线投稿
分享
 
 
 

C++内存管理详解

2008-06-01 02:08:15 编辑來源:互联网 国际版 评论
 
 
本文为【C++内存管理详解】的汉字拼音对照版显示拼音
  1.duiyingdenewhedeleteyaocaiyongxiangtongdexingshi xiamiandeyujuyoushenmecuo

  string *stringarray = new string[100];

  ...

  delete stringarray;

  yiqiehaoxiangdoujingranyouxuyigenewduiyingzheyigedeleteranerqueyincangzhehendadecuowuchengxudeyunxingqingkuangjiangshibukecaicedezhishaostringarrayzhixiangde100gestringduixiangzhongde99gebuhuibeizhengquedicuihuiyinweitamendexigouhanshuyongyuanbuhuibeitiaoyong

  yongnewdeshihouhuifashengliangjianshishouxianneicunbeifenpei(tongguooperator new hanshuxiangjiantiaokuan7-10hetiaokuanm8)ranhouweibeifenpeideneicuntiaoyongyigehuoduogegouzaohanshuyongdeletedeshihouyeyouliangjianshifashengshouxianweijiangbeishifangdeneicuntiaoyongyigehuoduogexigouhanshuranhoushifangneicun(tongguooperator delete hanshuxiangjiantiaokuan8hem8)duiyu deletelaishuohuiyouzheyangyigechongyaodewentineicunzhongyouduoshaogeduixiangyaobeishanchudaanjuedinglejiangyouduoshaogexigouhanshuhuibeitiaoyong

  zhegewentijiandanlaishuojiushiyaobeishanchudezhizhenzhixiangdeshidangeduixiangnehuanshiduixiangshuzuzhezhiyounilaigaosudeletejiarunizaiyongdeleteshimeiyongkuohaodeletejiuhuirenweizhixiangdeshidangeduixiangfouzetajiuhuirenweizhixiangdeshiyigeshuzu

  string *stringptr1 = new string;

  string *stringptr2 = new string[100];

  ...

  delete stringptr1;// shanchuyigeduixiang

  delete [] stringptr2;// shanchuduixiangshuzu

  jiarunizaistringptr1qianjiale"[]"huizenyangnedaanshinajiangshibukecaicedejiarunimeizaistringptr2qianmeijiashang"[]"youhuizenyangnedaanyeshibukecaiceerqieduiyuxiangintzheyangdegudingleixinglaishuojieguoyeshibukecaicedeji使shizheyangdeleixingmeiyouxigouhanshusuoyijiejuezheleiwentideguizehenjiandanjiarunitiaoyong newshiyongle[]tiaoyongdeleteshiyeyaoyong[]jiarutiaoyongnewshimeiyouyong[]natiaoyongdeleteshiyebuyaoyong[]

  zaixieyigebaohanzhizhenshujuchengyuanbingqietigongduogegouzaohanshudeleishilaojizheyiguizeyouqichongyaoyinweizheyangdehuanijiubixuzaisuoyouchushihuazhizhenchengyuandegouzaohanshulicaiyongxiangtongdenewdexingshifouzexigouhanshulijiangcaiyongshenmexingshidedeleteneguanyuzheyihuatidejinyibuchanshushenjiantiaokuan11

  zhegeguizeduixihuanyongtypedefderenlaishuoyehenchongyaoyinweixietypedefdechengxuyuanbixugaosubierenyongnewchuangjianleyigetypedefdingyideleixingdeduixianghougaiyongshenmexingshidedeletelaishanchujuliruxia

  typedef string addresslines[4]; //yigerendedizhigong4xingmeixingyigestring

  //yinweiaddresslinesshigeshuzu使shiyongnew:

  string *pal = new addresslines; // zhuchong"new addresslines"fanhuistring*, he

  // "new string[4]"fanhuideyiyang

  deleteshibixuyishuzuxingshiyuzhiduiying

  delete pal;// cuowu!

  delete [] pal;// zhengque

  weilebimianhunluanzuihaodujueduishuzuleixingyongtypedefszheqishihenqingyiyinweibiaozhunc++ku(jiantiaokuan49)baohanyoustirnghevectormoban使shiyongtamenjianghui使shiduishuzudexuqiujianshaodaojihulingjulilaishuoaddresslineskeyidingyiweiyigezifuchuan(string)dexiangliang(vector)ji addresslineskedingyiweivectorleixing

  2.xigouhanshuliduizhizhenchengyuantiaoyongdelete

  daduoshuqingkuangxiazhixingdongtaineicunfenpeidedeleidouzaigouzaohanshuliyongnewfenpeineicunranhouzaixigouhanshuliyongdeleteshifangneicunzuichuxiezhegeleideshihoudangranbunanzuonihuijidezuihouduizaisuoyougouzaohanshulifenpeileneicundesuoyouchengyuan使shiyongdelete

  ranerzhegeleijingguoweihushengjihouqingkuangjiuhuibiandekunnanleyinweiduileidedaimajinxingxiugaidechengxuyuanbuyidingjiushizuizaoxiezhegeleiderenerzengjiayigezhizhenchengyuanyiweizhejihudouyaojinxingxiamiandegongzuo

  ·zaimeigegouzaohanshuliduizhizhenjinxingchushihuaduiyuyixiegouzaohanshujiarumeiyouneicunyaofenpeigeizhizhendehuazhizhenyaobeichushihuawei0(jikongzhizhen)

  ·shanchuxianyoudeneicuntongguofuzhicaozuofufenpeigeizhizhenxindeneicun

  ·zaixigouhanshulishanchuzhizhen

  jiaruzaigouzaohanshuliwanglechushihuamougezhizhenhuozhezaifuzhicaozuodeguochengzhongwanglechulitawentihuichuxiandehenkuaihenmingxiansuoyizaishijianzhongzhelianggewentibuhuinamezhemonidanshijiaruzaixigouhanshulimeiyoushanchuzhizhentabuhuibiaoxianchuhenmingxiandewaibuzhengzhuangxiangfantakenengzhishibiaoxianweiyidianweixiaodeneicunxielubingqiebuduanzengchangzuihoutunshilenidedizhikongjiandaozhichengxuyaozheyinweizhezhongqingkuangjingchangbunameyinrenzhuchongsuoyimeizengjiayigezhizhenchengyuandaoleilishiyidingyaojiqingchu

  lingwaishanchukongzhizhenshianquande(yinweitashenmeyemeizuo)suoyizaixiegouzaohanshufuzhicaozuofuhuoqitachengyuanhanshushileidemeigezhizhenchengyuanyaomezhixiangyouxiaodeneicunyaomejiuzhixiangkongnazainidexigouhanshulinijiukeyizhiyongjiandandideletediaotamenerbuyongdanxintamenshibushibeinewguo

  dangranduibentiaokuande使shiyongyebuyaojueduilirunidangranbuhuiyongdeletequshanchuyigemeiyouyongnewlaichushihuadezhizhenerqiejiuxiangyongzhinengzhizhenduixiangshibuyonglaoniqushanchuyiyangniyeyongyuanbuhuiqushanchuyigechuandigeinidezhizhenhuanjuhuashuochufeileichengyuanzuichuyonglenew,fouzeshibuyongzaixigouhanshuliyongdeletede

  shuodaozhinengzhizhenzhelijieshaoyizhongbimianbixushanchuzhizhenchengyuandefangfajibazhexiechengyuanyongzhinengzhizhenduixianglaidaitibiruc++biaozhunkulideauto_ptrxiangzhidaotashiruhegongzuodekankantiaokuanm9hem10

  3.yuxianyubeihaoneicunbugoudeqingkuang

  operator newzaiwufawanchengneicunfenpeiqingqiushihuipaochuyichang(yiqiandezuofayibanshifanhui0yixiejiuyidiandebianyiqihuanzhemezuoniyuanyidehuayekeyibanidebianyiqishezhichengzheyangguanyuzhegehuatiwojiangtuichidaobentiaokuandejieyichutaolun)dajiadouzhidaochulineicunbugousuochanshengdeyichangzhenkeyisuandeshangshigedaodeshangdexingweidanshijizuoqilaiyouhuixiangdaojiazaibozishangnayangtongkusuoyiniyoushihuibuquguantayexuyizhimeiquguantadannixinliyidinghuanshishenshendiyincangzheyizhongzuieganwanyinewzhendechanshengleyichangzenmeban

  nihuihenzirandixiangdaochulizhezhongqingkuangdeyizhongfangfajihuidaoyiqiandelaolushangqu使shiyongyuchulilirucdeyizhongchangyongdezuofashidingyiyigeleixingwuguandehonglaifenpeineicunbingjianchafenpeishifouchenggongduiyuc++laishuozhegehongkanqilaikenengxiangzheyang

  

  

  #define new(ptr, type)

  try { (ptr) = new type; }

  catch (std::bad_alloc&) { assert(0); }

  manstd::bad_allocshizuoshenmedenihuiwenbad_allocshioperator newbunengmanzuneicunfenpeiqingqiushipaochudeyichangleixingstdshibad_allocsuozaidemingzikongjian(jiantiaokuan28)demingchenghaonihuijixuwenassertyouyoushenmeyongjiarunikankanbiaozhunctouwenjian(huoyutaxiangdengjiadeyongdaolemingzikongjiandebanbenjiantiaokuan49)jiuhuifaxianassertshigehongzhegehongjianchachuangeitadebiaodashishifoufeilingjiarubushifeilingzhijiuhuifachuyitiaochucuoxinxibingtiaoyongabortassertzhishizaimeidingyibiaozhunhongndebugdeshihoujizaitiaoshizhuangtaixiacaizhemezuozaichanpinfabuzhuangtaixiajidingyilendebugdeshihouassertshenmeyebuzuoxiangdangyuyitiaokongyujusuoyinizhinengzaitiaoshishicainengjianchaduanyan(assertion)

  newhongbudanyouzheshangmiansuoshuodetongbingjiyongassertqujianchakenengfashengzaiyifabuchengxulidezhuangtai(ranerrenheshihoudoukenengfashengneicunbugoudeqingkuang)tongshitahuanzaic ++liyoulingwaiyigequexiantameiyoukaolvdaonewyougezhonggeyangde使shiyongfangshiliruxiangchuangjianleixingtduixiangyibanyousanzhongchangjiandeyufaxingshinibixuduimeizhongxingshikenengchanshengdeyichangdouyaojinxingchuli

  new t;

  new t(constrUCtor arguments);

  new t[size];

  zheliduiwentidadajinxinglejianhuayinweiyourenhuanhuizidingyi(chongzai)operator newsuoyichengxulihuibaohanrenyige使shiyongnewdeyufaxingshi

  namezenmebanjiaruxiangyongyigehenjiandandechucuochulifangfakeyizhemezuodangneicunfenpeiqingqiubunengmanzushitiaoyongniyuxianzhidingdeyigechucuochulihanshuzhegefangfajiyuyigechangguijidangoperator newbunengmanzuqingqiushihuizaipaochuyichangzhiqiantiaoyongkehuzhidingdeyigechucuochulihanshuyibanchengweinew-handlerhanshu(operator newshijigongzuoqilaiyaofuduoyixiexiangjiantiaokuan8)

  zhidingchucuochulihanshushiyaoyongdaoset_new_handlerhanshutazaitouwenjianlidazhishixiangxiamianzheyangdingyide

  typedef void (*new_handler)();

  new_handler set_new_handler(new_handler p) throw();

  keyikandaonew_handlershiyigezidingyidehanshuzhizhenleixingtazhixiangyigemeiyoushurushenshuyemeiyoufanhuizhidehanshuset_new_handlerzeshiyigeshurubingfanhuinew_handlerleixingdehanshu

  set_new_handlerdeshurushenshushioperator newfenpeineicunshibaishiyaotiaoyongdechucuochulihanshudezhizhenfanhuizhishiset_new_handlermeitiaoyongzhiqianjiuyijingzaiqizuoyongdejiudechucuochulihanshudezhizhen

  keyixiangxiamianzheyang使shiyongset_new_handler

  // function to call if operator new can't allocate enough memory

  void nomorememory()

  {

  cerr << "unable to satisfy request for memory

  ";

  abort();

  }

  int main()

  {

  set_new_handler(nomorememory);

  int *pbigdataarray = new int[100000000];

  ...

  }

  jiaruoperator newbunengwei100,000,000gezhengshufenpeikongjiannomorememoryjianghuibeitiaoyongchengxufachuyitiaochucuoxinxihouzhongzhizhejiubijiandandirangxitongneigaichanshengcuowuxinxilaijieshuchengxuyaohao(shun便biankaolvyixiajiarucerrzaixiecuowuxinxideguochengzhongyaodongtaifenpeineicunnajianghuifashengshenme...)

  operator newbunengmanzuneicunfenpeiqingqiushinew-handlerhanshubuzhitiaoyongyiciershibuduanchongfuzhizhizhaodaozugoudeneicunshixianchongfutiaoyongdedaimazaitiaokuan8likeyikandaozheliwoyongmiaoshuxingdedeyuyanlaishuomingyigeshejidehaodenew-handlerhanshubixushixianxiamiangongnengzhongdeyizhong

  ·chanshenggengduodekeyongneicunzhejiang使shioperator newxiayicifenpeineicundechangshiyoukenenghuodechenggongshishizheyiceluedeyigefangfashizaichengxuqidongshifenpeiyigedadeneicunkuairanhouzaidiyicitiaoyongnew-handlershishifangshifangshibansuizheyixieduiyonghudejinggaoxinxiruneicunshuliangtaishaoxiaciqingqiukenenghuishibaichufeiyouyougengduodekeyongkongjian

  ·anzhuanglingyigebutongdenew-handlerhanshujiarudangqiandenew-handlerhanshubunengchanshenggengduodekeyongneicunkenengtahuizhidaolingyigenew- handlerhanshukeyitigonggengduodeziyuanzheyangdehuadangqiandenew-handlerkeyianzhuanglingyigenew-handlerlaiqudaita(tongguotiaoyong set_new_handler)xiayicioperator newtiaoyongnew-handlershihui使shiyongzuijinanzhuangdenage(zheyiceluedelingyigebiantongbanfashirangnew-handlerkeyigaibiantazijideyunxingxingweinamexiacitiaoyongshitajiangzuobutongdeshifangfashi使shinew-handlerkeyixiugainaxieyingxiangtazishenxingweidejingtaihuoquanjushuju)

  ·xiechunew-handleryejiushichuandikongzhizhengeiset_new_handlermeiyouanzhuangnew-handleroperator newfenpeineicunbuchenggongshijiuhuipaochuyigebiaozhundestd::bad_allocleixingdeyichang

  ·paochustd::bad_allochuocongstd::bad_allocjixudeqitaleixingdeyichangzheyangdeyichangbuhuibeioperator newbuzhuosuoyitamenhuibeisongdaozuichujinxingneicunqingqiudedifang(paochubiedebutongleixingdeyichanghuiweifanoperator newyichangguifanguifanzhongdequeshengxingweishitiaoyongabortsuoyinew-handleryaopaochuyigeyichangshiyidingyaoquexintashicongstd::bad_allocjixulaidexianggengduodilejieyichangguifanshenjiantiaokuanm14)

  ·meiyoufanhuidianxingzuofashitiaoyongaborthuoexitabort/exitkeyizaibiaozhunckuzhongzhaodao(huanyoubiaozhunc++kushenjiantiaokuan49)

  shangmiandexuanzegeilenishixiannew-handlerhanshujidadelinghuoxing

  chulineicunfenpeishibaideqingkuangshicaiqushenmefangfaqujueyuyaofenpeideduixiangdelei

  class x {

  public:

  static void

  

   outofmemory();

  ...

  };

  class y {

  public:

  static void outofmemory();

  ...

  };

  x* p1 = new x; // ruofenpeichenggongtiaoyongx::outofmemory

  y* p2 = new y; // ruofenpeibuchenggongtiaoyongy::outofmemory

  c++buzhichizhuanmenzhenduiyuleidenew-handlerhanshuerqieyebuxuyaonikeyizijilaishixiantazhiyaozaimeigeleizhongtigongzijibanbendeset_new_handlerheoperator newleideset_new_handlerkeyiweileizhidingnew-handler(jiuxiangbiaozhundeset_new_handlerzhidingquanjunew-handleryiyang)leideoperator newzebaozhengweileideduixiangfenpeineicunshiyongleidenew-handlerqudaiquanjunew-handler

  jiashechulileixneicunfenpeishibaideqingkuangyinweioperator newduileixingxdeduixiangfenpeineicunshibaishimeicidoubixutiaoyongchucuochulihanshusuoyiyaozaileilishengmingyigenew_handlerleixingdejingtaichengyuannameleixkanqilaihuixiangzheyang

  class x {

  public:

  static new_handler set_new_handler(new_handler p);

  static void * operator new(size_t size);

  private:

  static new_handler currenthandler;

  };

  leidejingtaichengyuanbixuzaileiwaidingyiyinweixiangjieyongjingtaiduixiangdequeshengchushihuazhi0suoyidingyix::currenthandlershimeiyouquchushihua

  new_handler x::currenthandler; //queshengshezhicurrenthandlerwei0(jinull)

  leixzhongdeset_new_handlerhanshuhuibaocunchuangeitaderenhezhizhenbingfanhuizaitiaoyongtazhiqiansuobaocunderenhezhizhenzhezhengshibiaozhunbanbendeset_new_handlersuozuode

  new_handler x::set_new_handler(new_handler p)

  {

  new_handler oldhandler = currenthandler;

  currenthandler = p;

  return oldhandler;

  }

  zuihoukankanxdeoperator newsuozuode

  1. tiaoyongbiaozhunset_new_handlerhanshushurushenshuweixdechucuochulihanshuzhe使shidexdenew-handlerhanshuchengweiquanjunew-handlerhanshuzhuchongxiamiandedaimazhongyongle"::"fuhaoxianshidiyinyongstdkongjian(biaozhunset_new_handlerhanshujiucunzaiyustdkongjian)

  2. tiaoyongquanjuoperator newfenpeineicunjiarudiyicifenpeishibaiquanjuoperator newhuitiaoyongxdenew-handleryinweitaganggang(jian1.)beianzhuangchengweiquanjunew-handlerjiaruquanjuoperator newzuizhongweinengfenpeidaoneicuntapaochustd::bad_allocyichangxdeoperator newhuibuzhuodaotaxdeoperator newranhouhuifuzuichubeiqudaidequanjunew-handlerhanshuzuihouyipaochuyichangfanhui

  3. jiashequanjuoperator newweileixingxdeduixiangfenpeineicunchenggong, xdeoperator newhuizaicitiaoyongbiaozhunset_new_handlerlaihuifuzuichudequanjuchucuochulihanshuzuihoufanhuifenpeichenggongdeneicundezhizhen

  c++shizhemezuode

  void * x::operator new(size_t size)

  {

  new_handler globalhandler = // anzhuangxdenew_handler

  std::set_new_handler(currenthandler);

  void *memory;

  try { // changshifenpeineicun

  memory = ::operator new(size);

  }

  catch (std::bad_alloc&) { // huifujiudenew_handler

  std::set_new_handler(globalhandler);

  throw; // paochuyichang

  }

  std::set_new_handler(globalhandler); // huifujiudenew_handler

  return memory;

  }

  jiaruniduishangmianchongfutiaoyongstd::set_new_handlerkanbushunyankeyishenjiantiaokuanm9laichuqutamen

  使shiyongleixdeneicunfenpeichuligongnengshidazhiruxia

  void nomorememory();// xdeduixiangfenpeineicunshibaishitiaoyongdenew_handlerhanshudeshengming

  x::set_new_handler(nomorememory);

  // banomorememoryshezhiweixde

  // new-handlinghanshu

  x *px1 = new x;

  // runeicunfenpeishibai

  // tiaoyongnomorememory

  string *ps = new string;

  // runeicunfenpeishibaitiaoyongquanjunew-handlinghanshu

  x::set_new_handler(0);

  // shexdenew-handlinghanshuweikong

  x *px2 = new x;

  // runeicunfenpeishibailijipaochuyichang

  // (leixmeiyounew-handlinghanshu)

  nihuizhuchongdaochuliyishangleisiqingkuangjiarubukaolvleidehuashixiandaimashiyiyangdezhejiuhenzirandixiangdaozaibiededifangyenengchongyongtamenzhengrutiaokuan41suoshuomingdejixuhemobankeyiyonglaishejikechongyongdaimazaizheliwomenbaliangzhongfangfajieheqilai使shiyongcongermanzulenideyaoqiu

  nizhiyaochuangjianyigehunhefengge(mixin-style)dejileizhezhongjileidayingzileijixutamouyitedingdegongnengzhelizhideshijianliyigeleidenew-handlerdegongnengzhisuoyishejiyigejileishiweilerangsuoyoudezileikeyijixuset_new_handlerheoperator newgongnengershejimobanshiweile使shimeigezileiyoubutongdecurrenthandlershujuchengyuanzhetingqilaihenfuduobuguonihuikandaodaimaqishihenshuxiqubiezhibuguoshitaxianzaikeyibeirenheleichongyongle

  template // tigongleiset_new_handlerzhichide

  class newhandlersupport { // hunhefenggedejilei

  public:

  static new_handler set_new_handler(new_handler p);

  

   static void * operator new(size_t size);

  private:

  static new_handler currenthandler;

  };

  template

  new_handler newhandlersupport::set_new_handler(new_handler p)

  {

  new_handler oldhandler = currenthandler;

  currenthandler = p;

  return oldhandler;

  }

  template

  void * newhandlersupport::operator new(size_t size)

  {

  new_handler globalhandler =

  std::set_new_handler(currenthandler);

  void *memory;

  try {

  memory = ::operator new(size);

  }

  catch (std::bad_alloc&) {

  std::set_new_handler(globalhandler);

  throw;

  }

  std::set_new_handler(globalhandler);

  return memory;

  }

  // this sets each currenthandler to 0

  template

  new_handler newhandlersupport::currenthandler;

  youlezhegemobanleiduileixjiashangset_new_handlergongnengjiuhenjiandanlezhiyaorangxcongnewhandlersupportjixu

  // note inheritance from mixin base class template. (see

  // my article on counting objects for information on why

  // private inheritance might be preferable here.)

  class x: public newhandlersupport {

  ... // as before, but no declarations for

  }; // set_new_handler or operator new

  使shiyongxdeshihouyiranbuyonglihuitamuhouzaizuoxieshenmelaodaimayirangongzuozhehenhaonaxienichangbuqulihuidedong西xiwangwangshizuikexinlaide

  使shiyongset_new_handlershichulineicunbugouqingkuangxiayizhongfang便bianjiandandefangfazhebibameigenewdoubaozhuangzaitrymokuailidangranhaoduoleerqie newhandlersupportzheyangdemoban使shidexiangrenheleizengjiayigetedingdenew-handlerbiandegengjiandanhunhefenggedejixubukebimiandijianghuatiyinrudaoduojixushangquzaizhuandaozhegehuatiqianniyidingyaoxianyuedutiaokuan43

  1993nianqianc++yizhiyaoqiuzaineicunfenpeishibaishioperator newyaofanhui0xianzaizeshiyaoqiuoperator newpaochustd::bad_allocyichanghenduoc++chengxushizaibianyiqikaishizhichixinguifanqianxiedec++biaozhunweiyuanhuibuxiangfangqinaxieyiyoudezunxunfanhui0guifandedaimasuoyitamentigonglelingwaixingshideoperator new(yijioperator new[]jiantiaokuan8)yijixutigongfanhui0gongnengzhexiexingshibeichengweiwupaochuyinweitamenmeiyongguoyigethrowershizai使shiyongnewderukoudiancaiyonglenothrowduixiang

  class widget { ... };

  widget *pw1 = new widget;// fenpeishibaipaochustd::bad_alloc if

  if (pw1 == 0) ... // zhegejianchayidingshibai

  widget *pw2 = new (nothrow) widget; // ruofenpeishibaifanhui0

  if (pw2 == 0) ... // zhegejianchakenenghuichenggong

  buguanshiyongzhenggui(jipaochuyichang)xingshidenewhuanshiwupaochuxingshidenewchongyaodeshinibixuweineicunfenpeishibaizuohaoyubeizuijiandandefangfashi使shiyongset_new_handleryinweitaduiliangzhongxingshidouyouyong

  4.xieoperator newheoperator deleteshiyaozunxunchanggui

  zijichongxieoperator newshi(tiaokuan10jieshileweishenmeyoushiyaochongxieta)henchongyaodeyidianshihanshutigongdexingweiyaohexitongqueshengdeoperator newyizhishijizuoqilaiyejiushiyaoyouzhengquedefanhuizhikeyongneicunbugoushiyaotiaoyongchucuochulihanshu(jiantiaokuan7)chulihao0zijieneicunqingqiudeqingkuangciwaihuanyaobimianbuxiaoxinyincanglebiaozhunxingshidenewbuguozheshitiaokuan9dehuati

  youguanfanhuizhidebufenhenjiandanjiaruneicunfenpeiqingqiuchenggongjiufanhuizhixiangneicundezhizhenjiarushibaizezunxuntiaokuan7deguidingpaochuyigestd::bad_allocleixingdeyichang

  danshiqingyebushinamejiandanyinweioperator newshijishanghuibuzhiyicidichangshizhequfenpeineicuntayaozaimeicishibaihoutiaoyongchucuochulihanshuhuanqiwangchucuochulihanshunengxiangbanfashifangbiechudeneicunzhiyouzaizhixiangchucuochulihanshudezhizhenweikongdeqingkuangxiaoperator newcaipaochuyichang

  lingwaic++biaozhunyaoqiuji使shizaiqingqiufenpei0zijieneicunshioperator newyeyaofanhuiyigehefazhizhen(shijishangzhegetingqilaiguaiguaideyaoqiuqueshigeic++yuyanqitadifangdailailejian便bian)

  zheyangfeileichengyuanxingshideoperator newdeweidaimakanqilaihuixiangxiamianzheyang

  void * operator new(size_t size) // operator newhuankenengyouqitashenshu

  {

  if (size == 0) { // chuli0zijieqingqiushi

  size = 1; // batadangzuo1gezijieqingqiulaichuli

  }

  while (1) {

  fenpeisizezijieneicun;

  if (fenpeichenggong)

  return (zhixiangneicundezhizhen);

  // fenpeibuchenggongzhaochudangqianchucuochulihanshu

  new_handler globalhandler = set_new_handler(0);

  set_new_handler(globalhandler);

  if (globalhandler) (*globalhandler)();

  else throw std::bad_alloc();

  }

  }

  chulilingzijieqingqiudejiqiaozaiyubatazuoweiqingqiuyigezijielaichulizhekanqilaiyehenguaidanjiandanhefayouxiaoerqieniyouhuiduojiupengdaoyicilingzijieqingqiudeqingkuangne

  niyouhuixiqishangmiandeweidaimazhongweishenmebachucuochulihanshuzhiwei0houyoulijihuifuzheshiyinweimeiyoubanfakeyizhijiededaochucuochulihanshudezhizhensuoyibixutongguotiaoyongset_new_handlerlaizhaodaobanfahenbendanyeyouxiao

  

  

  tiaokuan7tidaooperator newneibubaohanyigewuxianxunhuanshangmiandedaimaqingchudishuominglezheyidianwhile (1)jiangdaozhiwuxianxunhuantiaochuxunhuandeweiyibanfashineicunfenpeichenggonghuochucuochulihanshuwanchengletiaokuan7suomiaoshudeshijianzhongdeyizhongdedaolegengduodekeyongneicunanzhuangleyigexindenew -handler(chucuochulihanshu)xiechulenew-handlerpaochuleyigestd::bad_allochuoqipaishengleixingdeyichanghuozhefanhuishibaixianzaimingbaileweishenmenew-handlerbixuzuozhexiegongzuozhongdeyijianjiarubuzuooperator newlimiandexunhuanjiubuhuijieshu

  henduorenmeiyoushuxidaodeyidianshioperator newjingchanghuibeizileijixuzhehuidaozhimouxiefuduoxingshangmiandeweidaimazhonghanshuhuiqufenpeisizezijiedeneicun(chufeisizewei0)sizehenchongyaoyinweitashichuandigeihanshudeshenshudanshidaduoshuzhenduileisuoxiedeoperator new(baokuotiaokuan10zhongdenazhong)doushizhiweitedingdeleishejidebushiweisuoyoudeleiyebushiweitasuoyoudezileishejidezheyiweizheduiyuyigeleixdeoperator newlaishuohanshuneibudexingweizaishejidaoduixiangdedaxiaoshidoushijingquedesizeof(x)buhuidayebuhuixiaodanyouyucunzaijixujileizhongdeoperator newkenenghuibeitiaoyongquweiyigezileiduixiangfenpeineicun

  class base {

  public:

  static void * operator new(size_t size);

  ...

  };

  class derived: public base // derivedleimeiyoushengmingoperator new

  { ... }; //

  derived *p = new derived; // tiaoyongbase::operator new

  jiarubaseleideoperator newbuxiangfeigongfuzhuanmenquchulizhezhongqingkuangzhezhongqingkuangchuxiandekenengxingbudanazuijiandandebanfashibazhegecuowushuliangdeneicunfenpeiqingqiuzhuangeibiaozhunoperator newlaichulixiangxiamianzheyang

  void * base::operator new(size_t size)

  {

  if (size != sizeof(base)) // jiarushuliangcuowurangbiaozhunoperator new

  return ::operator new(size); // quchulizhegeqingqiu

  //

  ... // fouzechulizhegeqingqiu

  }

  ting!wotingjiannizaijiaoniwanglejianchayizhongsuiranbuhelidanshiyoukenengchuxiandeyizhongqingkuangsizeyoukenengweiling!shidewomeijianchadanbaituoxiacizaijiaochushengdeshihoubuyaozhemewenzhouzhoude:)danshijishangjianchahuanshizuolezhibuguoronghedaosize != sizeof(base)yujuzhonglec++biaozhunhenguaiyiqizhongzhiyijiushiguidingsuoyidulide(freestanding)leidedaxiaodoushifeilingzhisuoyisizeof(base)yongyuanbukenengshiling(ji使shibaseleimeiyouchengyuan)jiarusizeweilingqingqiuhuizhuandao::operator newyoutalaiyiyizhonghelidefangshiduiqingqiujinxingchuli(youqudeshijiarubasebushidulideleisizeof(base)youkenengshilingjutishuomingshenjian"my article on counting objects")

  jiaruxiangkongzhijiyuleideshuzudeneicunfenpeibixushixianoperator newdeshuzuxingshioperator new[](zhegehanshuchangbeichengweishuzunewyinweixiangbuchu"operator new[]")gaizenmefayin)xieoperator new[]shiyaojizhunimianduideshiyuanshineicunbunengduishuzulihuanbucunzaideduixiangjinxingrenhecaozuoshijishangnishenzhihuanbuzhidaoshuzuliyouduoshaogeduixiangyinweibuzhidaomeigeduixiangyouduodajileideoperator new[]huitongguojixudefangshibeiyonglaiweizileiduixiangdeshuzufenpeineicunerzileiduixiangwangwangbijileiyaodasuoyibunengxiangdangranrenweibase::operator new[]lidemeigeduixiangdedaxiaodoushisizeof(base)yejiushishuoshuzuliduixiangdeshuliangbuyidingjiushi(qingqiuzijieshu)/sizeof(base)guanyuoperator new[]dejutijieshaoshenjiantiaokuanm8

  chongxieoperator new(heoperator new[])shisuoyouyaozunxundechangguijiuzhexieduiyuoperator delete(yijitadehuobanoperator delete[])qingkuanggengjiandansuoyaojizhudezhishic++baozhengshanchukongzhizhenyongyuanshianquandesuoyiniyaochongfendiyingyongzheyibaozhengxiamianshifeileichengyuanxingshideoperator deletedeweidaima

  void operator delete(void *rawmemory)

  {

  if (rawmemory == 0) return; file://ru/guozhizhenweikongfanhui

  //

  shifangrawmemoryzhixiangdeneicun;

  return;

  }

  zhegehanshudeleichengyuanbanbenyejiandanzhishihuanbixujianchabeishanchudeduixiangdedaxiaojiasheleideoperator newjiangcuowudaxiaodefenpeiqingqiuzhuangei::operator newnameyebixujiangcuowudaxiaodeshanchuqingqiuzhuangei::operator delete

  class base { // heqianmianyiyangzhishizhelishengmingle

  public: // operator delete

  static void * operator new(size_t size);

  static void operator delete(void *rawmemory, size_t size);

  ...

  };

  void base::operator delete(void *rawmemory, size_t size)

  {

  if (rawmemory == 0) return; // jianchakongzhizhen

  if (size != sizeof(base)) { // jiarusize"cuowu"

  ::operator delete(rawmemory); // rangbiaozhunoperatorlaichuliqingqiu

  return;

  }

  shifangzhixiangrawmemorydeneicun;

  return;

  }

  kejianyouguanoperator newheoperator delete(yijitamendeshuzuxingshi)deguidingbushinamemafanchongyaodeshibixuzunshoutazhiyaoneicunfenpeichengxuzhichinew-handlerhanshubingzhengquedichulilelingneicunqingqiujiuchabuduolejiaruneicunshifangchengxuyouchulilekongzhizhennajiumeiqitashenmeyaozuodelezhiyuzaileichengyuanbanbendehanshulizengjiajixuzhichinajianghenkuaijiukeyiwancheng

  5.bimianyincangbiaozhunxingshidenew

  yinweineibufanweishengmingdemingchenghuiyincangdiaowaibufanweidexiangtongdemingchengsuoyiduiyufenbiezaileideneibu

  hequanjushengmingdelianggexiangtongmingzidehanshuflaishuoleidechengyuanhanshuhuiyincangdiaoquanjuhanshu

  void f(); // quanjuhanshu

  class x {

  public:

  void f(); // chengyuanhanshu

  };

  

   x x;

  f(); // tiaoyong f

  x.f(); // tiaoyong x::f

  zhebuhuilingrenjingqiyebuhuidaozhihunxiaoyinweitiaoyongquanjuhanshuhechengyuanhanshushizongshicaiyongbutongde

  yufaxingshiranerjiarunizaileilizengjialeyigedaiduogeshenshudeoperator newhanshujieguojiuyou

  kenenglingrendachiyijing

  class x {

  public:

  void f();

  // operator newdeshenshuzhidingyige

  // new-hander(newdechucuochuli)hanshu

  static void * operator new(size_t size, new_handler p);

  };

  void specialerrorhandler(); // dingyizaibiededifang

  x *px1 =

  new (specialerrorhandler) x; // tiaoyongx::operator new

  x *px2 = new x; // cuowu!

  zaileilidingyileyigechengweioperator newdehanshuhouhuibujingyidizuzhileduibiaozhunnewde访fang

  wentiaokuan50jieshileweishenmehuizheyangzheliwomengengguanxindeshiruhexianggebanfabimianzhegewenti

  yigebanfashizaileilixieyigezhichibiaozhunnewtiaoyongfangshideoperator newtahebiaozhunnewzuotongyang

  deshizhekeyiyongyigegaoxiaodeneilianhanshulaifengzhuangshixian

  class x {

  public:

  void f();

  static void * operator new(size_t size, new_handler p);

  static void * operator new(size_t size)

  { return ::operator new(size); }

  };

  x *px1 =

  new (specialerrorhandler) x; // tiaoyong x::operator

  // new(size_t, new_handler)

  x* px2 = new x; // tiaoyong x::operator

  // new(size_t)

  lingyizhongfangfashiweimeiyigezengjiadaooperator newdeshenshutigongqueshengzhi(jiantiaokuan24)

  class x {

  public:

  void f();

  static

  void * operator new(size_t size, // pqueshengzhiwei0

  new_handler p = 0); //

  };

  x *px1 = new (specialerrorhandler) x; // zhengque

  x* px2 = new x; // yezhengque

  wulunnazhongfangfajiaruyihouxiangduibiaozhunxingshidenewdingzhixindegongnengzhixuyaochongxiezhegehanshu

  tiaoyongzhechongxinbianyilianjiehoujiukeyi使shiyongxingongnengle

  6. jiaruxieleoperator newjiuyaotongshixieoperator delete

  rangwomenhuiguotouqukankanzheyangyigejibenwentiweishenmeyoubiyaoxiezijideoperator newheoperator delete

  daantongchangshiweilexiaolvqueshengdeoperator newheoperator deletejuyoufeichanghaodetongyongxingtadezhezhonglinghuoxingye使shidezaimouxietedingdechanghexiakeyijinyibugaishantadexingnengyouqizainaxiexuyaodongtaifenpeidaliangdedanhenxiaodeduixiangdeyingyongchengxuliqingkuanggengshiruci

  liruyouzheyangyigebiaoshifeijideleileiairplanezhibaohanyigezhizhentazhixiangdeshifeijiduixiangdeshijimiaoshu(cijishuzaitiaokuan34jinxingshuoming)

  class airplanerep { ... }; // biaoshiyigefeijiduixiang

  //

  class airplane {

  public:

  ...

  private:

  airplanerep *rep; // zhixiangshijimiaoshu

  };

  yigeairplaneduixiangbingbudatazhibaohanyigezhizhenzhengrutiaokuan14hem24suoshuomingdejiaruairplaneleishengminglexuhanshuhuiyinshibaohandiergezhizhendandangtiaoyongoperator newlaifenpeiyigeairplaneduixiangshidedaodeneicunkenengyaobicunchuzhegezhizhenhuoyiduizhizhensuoxuyaodeyaoduozhisuoyihuichanshengzhezhongkanqilaihenxiqidexingweizaiyuoperator newheoperator deletezhijianxuyaohuxiangchuandixinxi

  yinweiqueshengbanbendeoperator newshiyizhongtongyongxingdeneicunfenpeiqitabixukeyifenpeirenyidaxiaodeneicunkuaitongyangoperator deleteyeyaokeyishifangrenyidaxiaodeneicunkuaioperator deletexiangnongqingtayaoshifangdeneicunyouduodajiubixuzhidaodangchuoperator newfenpeideneicunyouduodayouyizhongchangyongdefangfakeyirangoperator newlaigaosuoperator deletedangchufenpeideneicundaxiaoshiduoshaojiushizaitasuofanhuideneicunliyuxianfudaiyixieewaixinxiyonglaizhimingbeifenpeideneicunkuaidedaxiaoyejiushishuodangnixielexiamiandeyuju

  airplane *pa = new airplane;

  nibuhuidedaoyikuaikanqilaixiangzheyangdeneicunkuai

  pa> airplaneduixiangdeneicun

  ershidedaoxiangzheyangdeneicunkuai

  pa> neicunkuaidaxiaoshuju + airplaneduixiangdeneicun

  duiyuxiangairplanezheyanghenxiaodeduixianglaishuozhexieewaideshujuxinxihui使shidedongtaifenpeiduixiangshisuoxuyaodedeneicundedaxiaofanfanfeifanshileilimeiyouxunihanshudeshihou

  jiaruruanjianyunxingzaiyigeneicunhenbaoguidehuanjingzhongjiuchengshoubuqizhezhongshechideneicunfenpeifanganleweiairplaneleizhuanmenxieyigeoperator newjiukeyiliyongmeigeairplanededaxiaodouxiangdengdetedianbubizaimeigefenpeideneicunkuaishangjiashangfudaixinxile

  jutilaishuoyouzheyangyigefangfalaishixiannidezidingyideoperator newxianrangqueshengoperator newfenpeiyixiedakuaideyuanshineicunmeikuaidedaxiaodouzuyirongnahenduogeairplaneduixiangairplaneduixiangdeneicunkuaijiuquzizhexiedadeneicunkuaidangqianmeibei使shiyongdeneicunkuaibeizuzhichenglianbiaochengweiziyoulianbiaoyibeiweilaiairplane使shiyongtingqilaihaoxiangmeigeduixiangdouyaochengdanyigenextyudekaixiaoyongyuzhichilianbiaodanbuhuirep yudekongjianyebeiyonglaicunchunextzhizhenyinweizhishizuoweiairplaneduixianglai使shiyongdeneicunkuaicaixuyaorepzhizhentongyangzhiyoumeizuoweiairplaneduixiang使shiyongdeneicunkuaicaixuyaonextzhizhenzhekeyiyongunionlaishixian

  

  

  jutishixianshijiuyaoxiugaiairplanededingyicongerzhichizidingyideneicunzhilikeyizhemezuo

  class airplane { // xiugaihoudelei zhichizidingyideneicunzhili

  public: //

  static void * operator new(size_t size);

  ...

  private:

  union {

  airplanerep *rep; // yongyubei使shiyongdeduixiang

  airplane *next; // yongyumeibei使shiyongdezaiziyoulianbiaozhongduixiang

  };

  // leidechangliangzhidingyigedadeneicunkuaizhongfangduoshaoge

  // airplaneduixiangzaihoumianchushihua

  static const int block_size;

  static airplane *headoffreelist;

  };

  shangmiandedaimazengjialedejigeshengmingyigeoperator newhanshuyigelianhe使shiderephenextyuzhanyongtongyangdekongjianyigechangliangzhidingdaneicunkuaidedaxiaoyigejingtaizhizhengenzongziyoulianbiaodebiaotoubiaotouzhizhenshengmingweijingtaichengyuanhenchongyaoyinweizhenggeleizhiyouyigeziyoulianbiaoerbushimeigeairplaneduixiangdouyou

  xiamiangaixieoperator newhanshule

  void * airplane::operator new(size_t size)

  {

  // bacuowudaxiaodeqingqiuzhuangei::operator new()chuli;

  // xiangjiantiaokuan8

  if (size != sizeof(airplane))

  return ::operator new(size);

  airplane *p = // pzhixiangziyoulianbiaodebiaotou

  headoffreelist; //

  // p ruohefazejiangbiaotouyidongdaotadexiayigeyuansu

  //

  if (p)

  headoffreelist = p->next;

  else {

  // ziyoulianbiaoweikongzefenpeiyigedadeneicunkuai

  // keyirongnablock_sizegeairplaneduixiang

  airplane *newblock =

  static_cast(::operator new(block_size *

  sizeof(airplane)));

  // jiangmeigexiaoneicunkuailianjieqilaixingchengyigexindeziyoulianbiao

  // tiaoguodi0geyuansuyinweitayaobeifanhuigeioperator newdetiaoyongzhe

  //

  for (int i = 1; i < block_size-1; ++i)

  newblock[i].next = &newblock[i+1];

  // yongkongzhizhenjieshulianbiao

  newblock[block_size-1].next = 0;

  // p sheweibiaodetoubuheadoffreelistzhixiangde

  // neicunkuaijingenqihou

  p = newblock;

  headoffreelist = &newblock[1];

  }

  return p;

  }

  jiaruniduletiaokuan8jiuhuizhidaozaioperator newbunengmanzuneicunfenpeiqingqiushihuizhixingyixilieyunew-handlerhanshuheliwaiyouguandelixingxingdongzuoshangmiandedaimameiyouzhexiebuzhouzheshiyinweioperator newzhilideneicundoushicong::operator newfenpeilaidezheyiweizhezhiyou::operator newshibaishioperator newcaihuishibaierjiaru::operator newshibaitahuiquzhixingnew-handlerdedongzuokenengzuihouyipaochuyichangjieshusuoyibuxuyaoairplanedeoperator newyequchulihuanjuhuashuoqishinew-handlerdedongzuodouhuanzainizhishimeikanjiantayincangzai::operator newli

  youleoperator newxiamianyaozuodejiushigeichuairplanedejingtaishujuchengyuandedingyi

  airplane *airplane::headoffreelist;

  const int airplane::block_size = 512;

  meibiyaoxianshidijiangheadoffreelistshezhiweikongzhizhenyinweijingtaichengyuandechushizhidoubeiqueshengshewei0block_sizejuedingleyaocong::operator newhuodeduodadeneicunkuai

  zhegebanbendeoperator newjianghuigongzuodefeichanghaotaweiairplaneduixiangfenpeideneicunyaobiqueshengoperator newgengshaoerqieyunxingdegengkuaikenenghuikuai2cifangdedengjizhemeishenmexiqidetongyongxingdequeshengoperator newbixuyingfugezhongdaxiaodeneicunqingqiuhuanyaochulineibuwaibudesuipianernideoperator newzhiyongcaozuolianbiaozhongdeyiduizhizhenpaoqilinghuoxingwangwangkeyihenqingyidihuanlaisudu

  xiamianwomenjiangtaolunoperator deletehuanjideoperator deletemabentiaokuanjiushiguanyuoperator deletedetaolundanzhidaoxianzaiweizhiairplaneleizhishengmingleoperator newhuanmeishengmingoperator deletexiangxiangjiaruxielexiamiandedaimahuifashengshenme:

  airplane *pa = new airplane; // tiaoyong

  // airplane::operator new

  ...

  delete pa; // tiaoyong ::operator delete

  duzheduandaimashijiarunishuqierduohuitingdaofeijizhuanghuiranshaodeshengyinhuanyouchengxuyuandekuqiwentichuzaioperator newzaiairplanelidingyidenagefanhuileyigebudaitouxinxideneicundezhizheneroperator deletequeshengdenagequejiashechuangeitadeneicunbaohantouxinxizhejiushibeijuchanshengdeyuanyin

  zhegelizishuomingleyigepubianyuanzeoperator newheoperator deletebixutongshixiezheyangcaibuhuichuxianbutongdejiashejiaruxieleyigezijideneicunfenpeichengxujiuyaotongshixieyigeshifangchengxuguanyuweishenmeyaozunxunzhetiaoguidingdelingyigeliyoushenjianarticle on counting objectsyiwendethe sidebar on placementzhangjie

  yinerjixushejiairplaneleiruxia

  class airplane { // heqianmiandeyiyangzhibuguozengjialeyige

  public: // operator deletedeshengming

  ...

  static void operator delete(void *deadobject,

  size_t size);

  };

  // chuangeioperator deletedeshiyigeneicunkuai, jiaru

  // qidaxiaozhengquejiujiadaoziyouneicunkuailianbiaodezuiqianmian

  //

  void airplane::operator delete(void *deadobject,

  

   size_t size)

  {

  if (deadobject == 0) return; // jiantiaokuan 8

  if (size != sizeof(airplane)) { // jiantiaokuan 8

  ::operator delete(deadobject);

  return;

  }

  airplane *carcass =

  static_cast(deadobject);

  carcass->next = headoffreelist;

  headoffreelist = carcass;

  }

  yinweiqianmianzaioperator newlijiangcuowudaxiaodeqingqiuzhuangeilequanjuoperator newjiantiaokuan8namezhelitongyangyaojiangcuowudaxiaodeduixiangjiaogeiquanjuoperator deletelaichulijiarubuzheyangjiuhuichongxianniqianmianfeijinxinsixiangbimiandenazhongwentinewhedeletejufashangdebupipei

  youqudeshijiaruyaoshanchudeduixiangshicongyigemeiyouxuxigouhanshudeleijixuerlaidenachuangeioperator deletedesize_tzhiyoukenengbuzhengquezhejiushibixubaozhengjileibixuyaoyouxuxigouhanshudeyuanyinciwaitiaokuan14huanliechulediergeliyougengchongzudeyuanyinzhelizhiyaojiandandijizhujileijiaruyiloulexunigouhanshuoperator deletejiuyoukenenggongzuobuzhengque

  suoyouyiqiedouhenhaodancongnizhouqidemeitouwokeyizhidaoniyidingzaidanxinneicunxieluyouzhedaliangkaifajingyandenibuhuimeizhuchongdaoairplanedeoperator newtiaoyong::operator new dedaoledakuaineicundanairplanedeoperator deletequemeiyoushifangtamenneicunxieluneicunxieluwofenmingtingjianlejingzhongzaininaohailihuixiang

  danqingzaixitingwohuidazhelimeiyouneicunxielu

  yinqineicunxieludeyuanyinzaiyuneicunfenpeihouzhixiangneicundezhizhendiushilejiarumeiyoulajichulihuoqitayuyanzhiwaidejizhizhexieneicunjiubuhuibeishouhuidanshangmiandeshejimeiyouneicunxieluyinweitajuebuhuichuxianneicunzhizhendiushideqingkuangmeigedaneicunkuaishouxianbeifenchengairplanedaxiaodexiaokuairanhouzhexiexiaokuaibeifangzaiziyoulianbiaoshangdangkehutiaoyong airplane::operator newshixiaokuaibeiziyoulianbiaoyichukehudedaozhixiangxiaokuaidezhizhendangkehutiaoyongoperator deleteshixiaokuaibeifanghuidaoziyoulianbiaoshangcaiyongzhezhongshejisuoyoudeneicunkuaiyaobubeiairplaneduixiang使shiyongzhezhongqingkuangxiashiyoukehulaifuzebimianneicunxieluyaobujiuzaiziyoulianbiaoshangzhezhongqingkuangxianeicunkuaiyouzhizhensuoyishuozhelimeiyouneicunxielu

  ranerqueshi::operator newfanhuideneicunkuaishiconglaimeiyoubeiairplane::operator deleteshifangzhegeneicunkuaiyougemingzijiaoneicunchidanneicunxielouheneicunchiyouyigechongyaodebutongzhichuneicunxielouhuiwuxiandizengchangji使shikehuxunguidaojuerneicunchidedaxiaojuebuhuichaoguokehuqingqiuneicundezuidazhi

  xiugaiairplanedeneicunzhilichengxu使shide::operator newfanhuideneicunkuaizaibubei使shiyongshizidongshifangbingbunandanzhelibuhuizhemezuozheyoulianggeyuanyindiyigeyuanyinhenizidingyineicunzhilidechuzhongyouguanniyouhenduoliyouquzidingyineicunzhilizuijibendeyitiaoshiniquerenqueshengdeoperator newheoperator delete使shiyongletaiduodeneicunhuobingqieyunxinghenmanhecaiyongneicunchiceluexiangbigenzongheshifangnaxiedaneicunkuaisuoxiedemeiyigeewaidezijiehemeiyitiaoewaideyujudouhuidaozhiruanjianyunxinggengmanyongdeneicungengduozaishejixingnengyaoqiuhengaodekuhuochengxushijiaruniyujineicunchidedaxiaohuizaiyigehelidefanweizhineinacaiyongneicunchidefangfazaihaobuguole

  diergeyuanyinhechuliyixiebuhelidechengxuxingweiyouguanjiasheairplanedeneicunzhilichengxubeixiugaileairplanedeoperator deletekeyishifangrenhemeiyouduixiangcunzaidedakuai