| [ CnUnix ] in KIDS 글 쓴 이(By): toddle (Rock) 날 짜 (Date): 2002년 8월 29일 목요일 오후 05시 06분 16초 제 목(Title): memory leak // test.cpp -------------------------------------------------------- unsigned long index=0; void colangw2guiCImpl::GcreateColanNode( const char* nodeId, const char* moduleName, CORBA::Short nodeType, const char* extpeId, CORBA::Short operationState ) IT_THROW_DECL(( CORBA::SystemException )) { //cout << "colangw2guiCImpl::GcreateColanNode(): called." << endl; //cout << nodeId << endl; //cout << moduleName << endl; //cout << nodeType << endl; //cout << extpeId<< endl; //cout << operationState<< endl; //cout << "colangw2guiCImpl::GcreateColanNode(): returning." << endl; //cout << " Notify Count : " << index <<endl; ----- (1) printf(" Notify Count : %d \n", index); ----- (2) index++; } ----------------------------------------------------------------------- 위와 같은 코드가 있어요 (코바와 관련 된 건데 이해 할 수 없는 현상이 일어나서..) index 라는 글로벌로 선언한 변수를 클래스 안에서 몇번 호출 되었나 확인하고 찍기 위해서 사용합니다. 그런데 (1) 과 같이 하면 memory leak 이 생기고 , (2)과 같이 하면 아무 문제 없네요.. 무엇 때문에 이런 문제가 생길까요.. . |