32비트 에서 64비트로 전환후 생긴 문제에 대해서 질문있습니다.

llblurryeyes의 이미지

32비트에선 나타나지 않은 문제인데여 64비트 전환중인데 32비트에선 잘되던게 64비트에서는 안됩니다.

프로그램을 종료시 32비트에선 소멸자가 한번만 실행되었었는데 갑자기 64비트에선 소멸자를 두번 불러옵니다.

end of CParameter
end of CParameter

그리고 나서

Program received signal SIGSEGV, Segmentation fault.
std::_List_base<s_ReduceRateSspkMapping, std::allocator<s_ReduceRateSspkMapping>
>::_M_clear (this=0xec9240) at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/list.tcc:76
76 _cur = static_cast<_Node*>(_cur->_M_next);

이렇게 오류메시지와 함께 프로세스가 죽지 않습니다.
이유를 잘 모르겠습니다.

헤더파일

list<s_ReduceRateSspkMapping> m_lstReduceRateSspkMapping;
 
void Set_ReduceRateSspkmapping(int a_iArmID, int a_iPlatFormID, int a_iCMeasureID, int a_iHitDataRate, int a_iKillDataRate);
 
void Get_ReduceRateSspkmapping(int a_iArmID, int a_iPlatFormID, int a_iCMeasureID, int* a_ipHitDataRate, int* a_ipKillDataRate);
 
CPP파일
 
CParameter::~CParameter() 
{
	cout << "end of CParameter" << endl;
}
 
void CParameter::Get_ReduceRateSspkmapping(int a_iArmID, int a_iPlatFormID, int a_iCMeasureID, int* a_ipHitDataRate, int* a_ipKillDataRate)
{
	list<s_ReduceRateSspkMapping>::iterator iter;
	for(iter = m_lstReduceRateSspkMapping.begin() ; iter != m_lstReduceRateSspkMapping.end() ; iter++ )
	{
		s_ReduceRateSspkMapping ReduceRate = *iter;
		if( a_iArmID == ReduceRate.iArmId && a_iPlatFormID == ReduceRate.iPlatformId && a_iCMeasureID == ReduceRate.iCmeasureId)
		{
			*a_ipHitDataRate = ReduceRate.iHitDataRate;
			*a_ipKillDataRate = ReduceRate.iKillDataRate;
			break;
		}
	}
}
 
void CParameter::Set_ReduceRateSspkmapping(int a_iArmID, int a_iPlatFormID, int a_iCMeasureID, int a_iHitDataRate, int a_iKillDataRate)
{
	s_ReduceRateSspkMapping ReduceRate;
	ReduceRate.iArmId = a_iArmID;
	ReduceRate.iPlatformId = a_iPlatFormID;
	ReduceRate.iCmeasureId = a_iCMeasureID;
	ReduceRate.iHitDataRate = a_iHitDataRate;
	ReduceRate.iKillDataRate = a_iKillDataRate;
 
	m_lstReduceRateSspkMapping.push_back(ReduceRate);
}

C++ 초보라 이유를 잘모르겠습니다. 설명부탁드립니다

winner의 이미지

소멸자가 두번 호출된다면 말이죠.

그런데 g++를 쓰면서 헝가리식 표기법을 보니 독특하군요.

llblurryeyes의 이미지

소멸자가 두번호출되는 경우는 어떤경우에 그런가여?
아무리 디버깅을 해도 잘모르겠어요

익명 사용자의 이미지

보내주신 코드만으로는 알기가 힘들겠습니다.

소멸자가 두번호출된다면 어디선가 임시객체가 만들어졌다가,
그게 없어지면서 호출되는 거라고 봐야겠지요

32bit에서는 안그러는데, 64bit에서만 그런거라면,
그 차이가 아니라 컴파일러가 다르거나, 컴파일 옵션이 다르겠지요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.