• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ delete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中delete函数的典型用法代码示例。如果您正苦于以下问题:C++ delete函数的具体用法?C++ delete怎么用?C++ delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DBG_INFO

boolean
TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
{
	/* NOTE: dataSize must be provided if info->data is zlib compressed. */

	if (!checksum || !info->data) return 0;

	uint8 *dest = info->data;
	uint32 format = info->format;

	if (!dataSize) {
		dataSize = TxUtil::sizeofTx(info->width, info->height, info->format);

		if (!dataSize) return 0;

		if (_options & (GZ_TEXCACHE|GZ_HIRESTEXCACHE)) {
			/* zlib compress it. compression level:1 (best speed) */
			uLongf destLen = _gzdestLen;
			dest = (dest == _gzdest0) ? _gzdest1 : _gzdest0;
			if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) {
				dest = info->data;
				DBG_INFO(80, wst("Error: zlib compression failed!\n"));
			} else {
				DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), (float)dataSize/1000, (float)destLen/1000);
				dataSize = destLen;
				format |= GL_TEXFMT_GZ;
			}
		}
	}

	/* if cache size exceeds limit, remove old cache */
	if (_cacheSize > 0) {
		_totalSize += dataSize;
		if ((_totalSize > _cacheSize) && !_cachelist.empty()) {
			/* _cachelist is arranged so that frequently used textures are in the back */
			std::list<uint64>::iterator itList = _cachelist.begin();
			while (itList != _cachelist.end()) {
				/* find it in _cache */
				std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(*itList);
				if (itMap != _cache.end()) {
					/* yep we have it. remove it. */
					_totalSize -= (*itMap).second->size;
					free((*itMap).second->info.data);
					delete (*itMap).second;
					_cache.erase(itMap);
				}
				itList++;

				/* check if memory cache has enough space */
				if (_totalSize <= _cacheSize)
					break;
			}
			/* remove from _cachelist */
			_cachelist.erase(_cachelist.begin(), itList);

			DBG_INFO(80, wst("+++++++++\n"));
		}
		_totalSize -= dataSize;
	}

	/* cache it */
	uint8 *tmpdata = (uint8*)malloc(dataSize);
	if (tmpdata) {
		TXCACHE *txCache = new TXCACHE;
		if (txCache) {
			/* we can directly write as we filter, but for now we get away
	   * with doing memcpy after all the filtering is done.
	   */
			memcpy(tmpdata, dest, dataSize);

			/* copy it */
			memcpy(&txCache->info, info, sizeof(GHQTexInfo));
			txCache->info.data = tmpdata;
			txCache->info.format = format;
			txCache->size = dataSize;

			/* add to cache */
			if (_cacheSize > 0) {
				_cachelist.push_back(checksum);
				txCache->it = --(_cachelist.end());
			}
			/* _cache[checksum] = txCache; */
			_cache.insert(std::map<uint64, TXCACHE*>::value_type(checksum, txCache));

#ifdef DEBUG
			DBG_INFO(80, wst("[%5d] added!! crc:%08X %08X %d x %d gfmt:%x total:%.02fmb\n"),
					 _cache.size(), (uint32)(checksum >> 32), (uint32)(checksum & 0xffffffff),
					 info->width, info->height, info->format & 0xffff, (float)_totalSize/1000000);

			if (_cacheSize > 0) {
				DBG_INFO(80, wst("cache max config:%.02fmb\n"), (float)_cacheSize/1000000);

				if (_cache.size() != _cachelist.size()) {
					DBG_INFO(80, wst("Error: cache/cachelist mismatch! (%d/%d)\n"), _cache.size(), _cachelist.size());
				}
			}
#endif

			/* total cache size */
			_totalSize += dataSize;
//.........这里部分代码省略.........
开发者ID:dankcushions,项目名称:GLideN64,代码行数:101,代码来源:TxCache.cpp


示例2: while

intptr_t RenderServer::main()
{
    RenderThreadsSet threads;

    while(1) {
        SocketStream *stream = m_listenSock->accept();
        if (!stream) {
            fprintf(stderr,"Error accepting connection, aborting\n");
            break;
        }

        unsigned int clientFlags;
        if (!stream->readFully(&clientFlags, sizeof(unsigned int))) {
            fprintf(stderr,"Error reading clientFlags\n");
            delete stream;
            continue;
        }

        DBG("RenderServer: Got new stream!\n");

        // check if we have been requested to exit while waiting on accept
        if ((clientFlags & IOSTREAM_CLIENT_EXIT_SERVER) != 0) {
            m_exiting = true;
            break;
        }

        RenderThread *rt = RenderThread::create(stream, &m_lock);
        if (!rt) {
            fprintf(stderr,"Failed to create RenderThread\n");
            delete stream;
            stream = NULL;
        } else if (!rt->start()) {
            fprintf(stderr,"Failed to start RenderThread\n");
            delete rt;
            rt = NULL;
        }

        //
        // remove from the threads list threads which are
        // no longer running
        //
        for (RenderThreadsSet::iterator n,t = threads.begin();
             t != threads.end();
             t = n) {
            // first find next iterator
            n = t;
            n++;

            // delete and erase the current iterator
            // if thread is no longer running
            if ((*t)->isFinished()) {
                delete (*t);
                threads.erase(t);
            }
        }

        // if the thread has been created and started, insert it to the list
        if (rt) {
            threads.insert(rt);
            DBG("Started new RenderThread\n");
        }
    }

    //
    // Wait for all threads to finish
    //
    for (RenderThreadsSet::iterator t = threads.begin();
         t != threads.end();
         t++) {
        (*t)->wait(NULL);
        delete (*t);
    }
    threads.clear();

    //
    // de-initialize the FrameBuffer object
    //
    FrameBuffer::finalize();
    return 0;
}
开发者ID:aosp-hybris,项目名称:platform_external_qemu,代码行数:80,代码来源:RenderServer.cpp


示例3: destroy

// ---------------------------------------------------------------------------
// 
// ------------
void destroy(bGenericXMLBaseElement *elt){
//bTrace trc("lib::destroy",false);
//trc.msg("parent instance (%x) of %s deleted",elt,"bCalcCNbParts");
	delete (bCalcCNbParts*)(void*)elt;
}
开发者ID:CarteBlancheConseil,项目名称:Instances,代码行数:8,代码来源:main.cpp


示例4: delete

ViewElementList::~ViewElementList()
{
    for (iterator i = begin(); i != end(); ++i) {
        delete (*i);
    }
}
开发者ID:UIKit0,项目名称:rosegarden,代码行数:6,代码来源:ViewElement.cpp


示例5: qtd_QDesktopServices_delete

QTD_EXTERN QTD_EXPORT void qtd_QDesktopServices_delete(void* nativeId)
{
    delete (QDesktopServices_QtDShell*)nativeId;
}
开发者ID:dreamsxin,项目名称:nawia,代码行数:4,代码来源:QDesktopServices_shell.cpp


示例6: RandomList

void genetics::select(int chunk, int nBiasWheel, double mutFactor, double crossOverFactor, int nCpy) {

    for(int it = 0; it<nNets; it+=chunk) {
        RandomList *rl = new RandomList(nNets);
        int* mixedArray = rl->GetMixedArray();
        biasWheel *bw = new biasWheel(nBiasWheel);
        //printf("===== Selection =====\n");
        for(int i = 0; i < nBiasWheel; i++) {
            int ind = mixedArray[i];
            //printf("%1.5f\n",1-meanErr[ind]);
            bw->addObject(nets[ind],1-meanErr[ind],ind);
        }
        //printf("=====================\n");
        //bw->print();

#ifdef BIASWHEEL_STATS
        int *selectionIndexes = (int*) malloc (sizeof(int)*nNets);
        double *selectionProb = (double*) malloc (sizeof(double)*nNets);
        for(int p = 0; p<nNets; p++) {
            selectionIndexes[p] = 0;
            selectionProb[p] = 0.0;
        }
#endif

        for(int k = 0; k<chunk; k+=2) {
            biasWheel::couple c;
            bw->electCouple(&c);

            //printf("Couple elected %p %p\n",c.A,c.B);

            network *mom = (network*)c.A;
            network *dad = (network*)c.B;

#ifdef BIASWHEEL_STATS
            printf("%03d %03d %1.6f %1.6f\n",c.iA,c.iB,c.pA,c.pB);
            selectionIndexes[c.iA]++;
            selectionIndexes[c.iB]++;

            selectionProb[c.iA] = c.pA;
            selectionProb[c.iB] = c.pB;
#endif
            lovemaking(mom, dad, childNets[it+k], childNets[it+k+1], mutFactor, crossOverFactor);
        }

        // TODO Copy the N best elements into child population
        mixedArray = rl->GetMixedArray();
        for(int i = 0; i<nCpy; i++) {
            int ind = mixedArray[i];
            double *top = nets[i]->extractGenome(false);
            childNets[ind]->setGenome(top);
            free(top);
        }

        // Alternate between child an parents
        for(int i = 0; i<nNets; i++) {
            network *tmp = nets[i];
            if(tmp == NULL) {
                printf("%d #YOLO MAIS YOLO\n",i);
                while(1);
            }
            nets[i] = childNets[i];
            childNets[i] = tmp;
        }

#ifdef BIASWHEEL_STATS
        printf("--BW_STATS-\n");
        for(int i = 0; i< nNets; i++) {
            if(selectionProb[i] != 0.0)
                printf("%03d;%1.5f\n",selectionIndexes[i],selectionProb[i]);
        }

        free(selectionIndexes);
        free(selectionProb);
#endif
        delete(bw);
        delete(rl);
    }
}
开发者ID:benoitclem,项目名称:GANN,代码行数:78,代码来源:gann.cpp


示例7: DisposeScreenRef

// Free memory associated with a ScreenRef
void		DisposeScreenRef( ScreenRef display )
{
	delete (RLDisplay *) display;
}
开发者ID:mctully,项目名称:tntbasic,代码行数:5,代码来源:RLDisplayMachO.cpp


示例8: QTCEXPORT

QTCEXPORT(void,qtc_QTextCharFormat_delete)(void* x0) {
  delete((QTextCharFormat*)x0);
}
开发者ID:bennofs,项目名称:hsQt,代码行数:3,代码来源:QTextCharFormat.cpp


示例9: main


//.........这里部分代码省略.........
        // exit opportunity found
        // check current exposure
        double* btcUsed = (double*)malloc(sizeof(double) * num_exchange);
        for (int i = 0; i < num_exchange; ++i) {
          btcUsed[i] = getActivePos[i](params);
        }
        double volumeLong = btcUsed[res.idExchLong];
        double volumeShort = btcUsed[res.idExchShort];
        double limPriceLong = getLimitPrice[res.idExchLong](params, volumeLong, true);
        double limPriceShort = getLimitPrice[res.idExchShort](params, volumeShort, false);

        if (res.priceLongOut - limPriceLong > params.priceDeltaLim || limPriceShort - res.priceShortOut > params.priceDeltaLim) {
          logFile << "WARNING: Opportunity found but not enough liquidity. Trade canceled" << std::endl;
          logFile << "         Target long price:  " << res.priceLongOut << ", Real long price:  " << limPriceLong << std::endl;
          logFile << "         Target short price: " << res.priceShortOut << ", Real short price: " << limPriceShort << std::endl;
          res.trailing[res.idExchLong][res.idExchShort] = 1.0;
        } else {
          res.exitTime = currTime;
          res.priceLongOut = limPriceLong;
          res.priceShortOut = limPriceShort;
          res.printExit(*params.logFile);
          int longOrderId = 0;
          int shortOrderId = 0;
          logFile << std::setprecision(6) << "BTC exposure on " << params.exchName[res.idExchLong] << ": " << volumeLong << std::setprecision(2) << std::endl;
          logFile << std::setprecision(6) << "BTC exposure on " << params.exchName[res.idExchShort] << ": " << volumeShort << std::setprecision(2) << std::endl;
          logFile << std::endl;
          // send orders
          longOrderId = sendOrder[res.idExchLong](params, "sell", fabs(btcUsed[res.idExchLong]), btcVec[res.idExchLong]->getBid());
          shortOrderId = sendOrder[res.idExchShort](params, "buy", fabs(btcUsed[res.idExchShort]), btcVec[res.idExchShort]->getAsk());
          // wait for the orders to be filled
          logFile << "Waiting for the two orders to be filled..." << std::endl;
          sleep(3.0);
          while (!isOrderComplete[res.idExchLong](params, longOrderId) || !isOrderComplete[res.idExchShort](params, shortOrderId)) {
            sleep(3.0);
          }
          logFile << "Done\n" << std::endl;
          longOrderId = 0;
          shortOrderId = 0;
          inMarket = false;
          // new balances
          for (int i = 0; i < num_exchange; ++i) {
            newBalUsd[i] = getAvail[i](params, "usd");
            newBalBtc[i] = getAvail[i](params, "btc");
          }
          for (int i = 0; i < num_exchange; ++i) {
            logFile << "New balance on " << params.exchName[i] << ":  \t";
            logFile << newBalUsd[i] << " USD (perf $" << newBalUsd[i] - balanceUsd[i] << "), ";
            logFile << std::setprecision(6) << newBalBtc[i]  << std::setprecision(2) << " BTC" << std::endl;
          }
          logFile << std::endl;
          // update res with total balance
          for (int i = 0; i < num_exchange; ++i) {
            res.befBalUsd += balanceUsd[i];
            res.aftBalUsd += newBalUsd[i];
          }
          // update current balances with new values
          for (int i = 0; i < num_exchange; ++i) {
            balanceUsd[i] = newBalUsd[i];
            balanceBtc[i] = newBalBtc[i];
          }
          logFile << "ACTUAL PERFORMANCE: " << "$" << res.aftBalUsd - res.befBalUsd << " (" << res.totPerf() * 100.0 << "%)\n" << std::endl;
          csvFile << res.id << "," << res.exchNameLong << "," << res.exchNameShort << "," << printDateTimeCsv(res.entryTime) << "," << printDateTimeCsv(res.exitTime);
          csvFile << "," << res.getLength() << "," << res.exposure * 2.0 << "," << res.befBalUsd << "," << res.aftBalUsd << "," << res.totPerf() << "\n";
          csvFile.flush();
          if (params.sendEmail) {
            sendEmail(res, params);
            logFile << "Email sent" << std::endl;
          }
          res.clear();
          std::ifstream infile("stop_after_exit");
          if (infile.good()) {
            logFile << "Exit after last trade (file stop_after_exit found)" << std::endl;
            stillRunning = false;
          }
        }
      }
      if (params.verbose) {
        logFile << std::endl;
      }
    }
    timeinfo->tm_sec = timeinfo->tm_sec + params.gapSec;
    currIteration++;
    if (currIteration >= params.debugMaxIteration) {
      logFile << "Max iteration reached (" << params.debugMaxIteration << ")" <<std::endl;
      stillRunning = false;
    }
  }
  for (int i = 0; i < num_exchange; ++i) {
    delete(btcVec[i]);
  }
  curl_easy_cleanup(params.curl);
  curl_global_cleanup();
  if (params.useDatabase) {
    mysql_close(params.dbConn);
  }
  csvFile.close();
  logFile.close();

  return 0;
}
开发者ID:mori170,项目名称:blackbird,代码行数:101,代码来源:main.cpp


示例10: switch

vsx_module_param_list::~vsx_module_param_list()
{
  for (unsigned long i = 0; i < id_vec.size(); ++i)
  {
    switch ( id_vec[i]->type )
    {
      case VSX_MODULE_PARAM_ID_INT:
        delete ((vsx_module_param_int*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_RENDER:
        delete ((vsx_module_param_render*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_FLOAT3:
        delete ((vsx_module_param_float3*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_DOUBLE:
        delete ((vsx_module_param_double*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_STRING:
        delete ((vsx_module_param_string*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_TEXTURE:
        delete ((vsx_module_param_texture*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_FLOAT:
        delete ((vsx_module_param_float*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_FLOAT4:
        delete ((vsx_module_param_float4*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_MATRIX:
        delete ((vsx_module_param_matrix*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_MESH:
        delete ((vsx_module_param_mesh*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_BITMAP:
        delete ((vsx_module_param_bitmap*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_PARTICLESYSTEM:
        delete ((vsx_module_param_particlesystem*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_FLOAT_ARRAY:
        delete ((vsx_module_param_float_array*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_FLOAT3_ARRAY:
        delete ((vsx_module_param_float3_array*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_QUATERNION_ARRAY:
        delete ((vsx_module_param_quaternion_array*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_SEQUENCE:
        delete ((vsx_module_param_sequence*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_SEGMENT_MESH:
        delete ((vsx_module_param_segment_mesh*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_ABSTRACT:
        delete ((vsx_module_param_abstract*)id_vec[i]);
        break;


      case VSX_MODULE_PARAM_ID_QUATERNION:
        delete ((vsx_module_param_quaternion*)id_vec[i]);
        break;

//.........这里部分代码省略.........
开发者ID:CJFocke,项目名称:vsxu,代码行数:101,代码来源:vsx_param.cpp


示例11: delete

GlutDrawManager::
~GlutDrawManager(
){

	delete(m_drawer);
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:6,代码来源:GlutDrawer.cpp


示例12: jsonnet_internal_free_vm

void jsonnet_internal_free_vm(struct JsonnetVm *x) {
    delete(x);
}
开发者ID:google,项目名称:go-jsonnet,代码行数:3,代码来源:libjsonnet.cpp


示例13: deleteALEntry

extern "C" void AL_FUNCTION deleteALEntry( hALEntry entry )
{
    AL_ASSERT_OBJECT( entry, ALEntry, "deleteALEntry" );
    delete (ALEntry *) entry;
}
开发者ID:softwarepublico,项目名称:lightbase,代码行数:5,代码来源:CXL_ENTR.CPP


示例14: deleteNorm2AllModes

U_CDECL_BEGIN

static void U_CALLCONV deleteNorm2AllModes(void *allModes) {
    delete (Norm2AllModes *)allModes;
}
开发者ID:icu-project,项目名称:icu4c,代码行数:5,代码来源:loadednormalizer2impl.cpp


示例15: delete

void profortosi_progress_1_1::back()
{
	delete(this);
}
开发者ID:algogr,项目名称:Elina_Scanner,代码行数:4,代码来源:profortosi_progress_1_1.cpp


示例16: NS_DestroyPluginInstance

void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin)
{
  if(aPlugin)
    delete (nsPluginInstance *)aPlugin;
}
开发者ID:xgc820313,项目名称:npapi-msdocs,代码行数:5,代码来源:plugin.cpp


示例17: exec_cmd

int exec_cmd(int under_glob, int under_until)
	{
	register int status;
	register char *p;
	int n;

	if((status = getrange()) <= ERROR)
		return( status );
	status = ERROR9;

	switch( *lp++ ) {

	case 'i':
		laddr2 = prevln(laddr2);

	case 'a':
		status = append(laddr2, under_glob);
		break;

	case 'b':
			if(!under_glob  &&  !under_until)
				status = branch();
		break;

	case 'c':
		if((status = delete(laddr1, laddr2, SAVE)) == OK)
			status = append(prevln(laddr1), under_glob);
		break;

	case 'd':
		if((status = delete(laddr1, laddr2, SAVE)) == OK && nextln(curln) != 0)
			curln = nextln(curln);
		break;

	case 'e':
		if(lastln  &&  dirty  &&  *lp != 'e') {
			status = ERROR4;
			break;
			}

		if(*lp == 'e')
			++lp;

		if(nladdrs == 0  &&  !under_glob  &&  !under_until  &&
			(status = getfn()) == OK) {
			set_fn(curfile, lp);
			if(lastln != 0)
				delete(1, lastln, NOSAVE);
			num_delete_lines = 0;
			if((status = _read( lp, 0, 0)) == OK) {
				dirty = 0;
				if(lastln)
					curln = 1;
				}
			}
		lp = "\n";
		break;

	case 'f':
		if(nladdrs == 0  &&  (status = getfn()) == OK) {
			set_fn(curfile, lp);
			putmsg(curfile);
			lp = "\n";
			}
		change_state(CMD);
		break;

	case 'g':
		if(!under_glob) {
			if(*lp == '^') {
				++lp;
				n = 0;
				}
			else
				n = 1;
			status = exec_glob(n, under_until);
			}
		break;

	case 'h':
		n = getint();
#ifndef __STDC__
		while(n--)
			for(n1 = 0; n1 < 10; ++n1)
				time_slice();
#endif
		status = OK;
		break;

	case 'j':
		status = join(laddr2);
		break;

	case 'k':
		if((status = get_laddr_expr(&n)) == OK)
			status = kopy(n);
		break;

	case 'l':
		if(nladdrs == 0)
//.........这里部分代码省略.........
开发者ID:vocho,项目名称:openqnx,代码行数:101,代码来源:command.c


示例18: delete

void Harmonizer2::cleanup(LV2_Handle instance)
{
    delete ((Harmonizer2 *) instance);
}
开发者ID:EQ4,项目名称:mod-pitchshifter,代码行数:4,代码来源:Harmonizer2.cpp


示例19: delete

void PacketClean::Proc(Packet *pkt){
//	cout << "Packet Clean-----------------------" << endl;
	struct timeval	packet_timestamp = pkt->GetTimestamp();

	if(savemode == PACKET){
		delete(pkt);
	}else if(savemode == STREAM){
		//if packet has no parent stream, delete it
		if(pkt->GetStream() == NULL){
			delete(pkt);
		}
	}

	//Stream End
	if(!end_stream_list.empty()){
//	cout << "Stream Endddddddd-----------------------" << endl;
//			cout << "end_stream_list size is :" << end_stream_list.size() << endl;
		for(list<Stream *>::iterator it=end_stream_list.begin(); it != end_stream_list.end(); it++){
				delete(*it);
		//	}
		}
		end_stream_list.clear();
	}


		//Gabage collect is enough 1 sec. each.
		if(packet_timestamp.tv_sec - last_gc_time.tv_sec >= 1){


			//Check all stream for timeout.
			for(list<Stream *>::iterator it=stream_pool->GetStreamFirstIt(); it != stream_pool->GetStreamLastIt(); it++){
//				cout << "Stream timeout-----------------------" << endl;
//				cout << "packet timestamp sec: " << packet_timestamp.tv_sec << endl;
//				cout << "GetLastUpdatedTime: " << (*it)->GetLastUpdatedTime().tv_sec  << endl;
//				cout << "Division: " << packet_timestamp.tv_sec - (*it)->GetLastUpdatedTime().tv_sec  << endl;
//				cout << "gc_removetime: " << gc_remove_time << endl;
//				cout << atoi(config->get("gc_remove_time").c_str()) << endl;
				if( packet_timestamp.tv_sec - (*it)->GetLastUpdatedTime().tv_sec >= atoi(config->get("gc_remove_time").c_str()) ){
					list<Stream *>::iterator it2;
					it2 = --it;
					++it;
					if(it != stream_pool->GetStreamLastIt()){
						delete *it;
					}
					it = it2;
				}
			}

			//Check all tcpconn for timeout.
			for(multimap<u_int, TcpConn*>::iterator it=tcp_conn_pool->GetTcpConnFirstIt(); it != tcp_conn_pool->GetTcpConnLastIt(); ++it){
//				cout << "TCP connection timeout-----------------------" << endl;
				if( packet_timestamp.tv_sec - (it->second)->GetLastUpdatedTime().tv_sec >=  atoi(config->get("gc_remove_time").c_str()) ){
					multimap<u_int, TcpConn*>::iterator it2;
						it2 = --it;
						++it;
					if(it != tcp_conn_pool->GetTcpConnLastIt()){
				//cout << "TcpConn removing!!"<< endl;
						delete it->second;
					}
					it = it2;
				}
			}

			last_gc_time.tv_sec = packet_timestamp.tv_sec;
		}
//		cout << "stream num :"<<stream_pool.GetSize()<< endl;
}
开发者ID:Shinichi-Ishida,项目名称:negi,代码行数:67,代码来源:PacketClean.C


示例20: delete

DataHandler::~DataHandler() {
    delete(this->logger);
}
开发者ID:LeHack,项目名称:hackttp,代码行数:3,代码来源:DataHandler.cpp



注:本文中的delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ delete0函数代码示例发布时间:2022-05-30
下一篇:
C++ delegate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap