strange assertion caused by auto-delete
Paul B -- Paul.B.Folbrecht@JCI.Com
Monday, March 31, 1997
Paul B Folbrecht
03/31/97 04:12 PM
Environment: VC++ 4.1, Win95
I have a CView-derived object that causes an assertion on line 1018 of
dbgheap.c on deletion (it's using auto-delete as normal).
Here's the line:
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
The stack looks like this:
_free_dbg_lk(int 4, void * 0x00a8a478) line 1017 + 102 bytes
_free_dbg(int 4, void * 0x00a8a478) line 970 + 13 bytes
CObject::operator delete(void * 0x00a8a478) line 44 + 12 bytes
CSummaryGrid::`scalar deleting destructor'() + 39 bytes
CView::PostNcDestroy() line 120 + 35 bytes
CWnd::OnNcDestroy() line 831
CWnd::OnWndMsg(unsigned int 130, unsigned int 0, long 0, long *
0x00a6edac) line 1838
CWnd::WindowProc(unsigned int 130, unsigned int 0, long 0) line 1617 +
30 bytes
AfxCallWndProc(CWnd * 0x00a8a478 {CObject}, HWND__ * 0x0000030c,
unsigned int 130, unsigned int 0, long 0) line 209 + 26 bytes
AfxWndProc(HWND__ * 0x0000030c, unsigned int 130, unsigned int 0, long
0) line 362 + 25 bytes
AfxWndProcBase(HWND__ * 0x0000030c, unsigned int 130, unsigned int 0,
long 0) line 176 + 21 bytes
KERNEL32! bff73663()
KERNEL32! bff928e0()
00007efa()
058f64c9()
The class declares a virtual destructor that does nothing. There's
nothing at all out of the ordinary that I can see.
As an aside, can anyone explain to me the purpose of "scaling deleting
destructors"?
-Paul Folbrecht
Compuware Corp.
Ron Jacobs -- Ron.Jacobs@centurasoft.com
Tuesday, April 01, 1997
Paul,
I had a problem like this once and it turned out to be that I was
mixing a DLL with dynamically linked MFC with an EXE that had
statically linked MFC and passing CStrings between them. The result of
this was that if I passed a CString from the EXE with statically
linked MFC to the DLL with dynamically linked MFC, the MFC for the DLL
thought that the string had valid data and tried to free it when it
really didn't have valid data.
Could that be what you are running into?
Ron Jacobs
Centura Software Corporation
Ron.Jacobs@centurasoft.com
______________________________ Reply Separator _________________________________
Subject: strange assertion caused by auto-delete
Author: mfc-l@netcom.com at SMTPLINK-GC
Date: 4/1/97 5:30 AM
Paul B Folbrecht
03/31/97 04:12 PM
Environment: VC++ 4.1, Win95
I have a CView-derived object that causes an assertion on line 1018 of
dbgheap.c on deletion (it's using auto-delete as normal).
Here's the line:
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
The stack looks like this:
_free_dbg_lk(int 4, void * 0x00a8a478) line 1017 + 102 bytes
_free_dbg(int 4, void * 0x00a8a478) line 970 + 13 bytes
CObject::operator delete(void * 0x00a8a478) line 44 + 12 bytes
CSummaryGrid::`scalar deleting destructor'() + 39 bytes
CView::PostNcDestroy() line 120 + 35 bytes
CWnd::OnNcDestroy() line 831
CWnd::OnWndMsg(unsigned int 130, unsigned int 0, long 0, long *
0x00a6edac) line 1838
CWnd::WindowProc(unsigned int 130, unsigned int 0, long 0) line 1617 +
30 bytes
AfxCallWndProc(CWnd * 0x00a8a478 {CObject}, HWND__ * 0x0000030c,
unsigned int 130, unsigned int 0, long 0) line 209 + 26 bytes
AfxWndProc(HWND__ * 0x0000030c, unsigned int 130, unsigned int 0, long
0) line 362 + 25 bytes
AfxWndProcBase(HWND__ * 0x0000030c, unsigned int 130, unsigned int 0,
long 0) line 176 + 21 bytes
KERNEL32! bff73663()
KERNEL32! bff928e0()
00007efa()
058f64c9()
The class declares a virtual destructor that does nothing. There's
nothing at all out of the ordinary that I can see.
As an aside, can anyone explain to me the purpose of "scaling deleting
destructors"?
-Paul Folbrecht
Compuware Corp.
Stuart Downing -- sdowning@fame.com
Tuesday, April 01, 1997
[Mini-digest: 2 responses]
> I have a CView-derived object that causes an assertion on line =
1018 >of
> dbgheap.c on deletion (it's using auto-delete as normal).
>
> Here's the line:
> _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
If speculation is worth anything...
I suspect you are calling delete on a rogue pointer. Perhaps a pointer =
that has already been deleted once, and is being deleted again?
>
> As an aside, can anyone explain to me the purpose of "scaling =
>deleting
> destructors"?
Speculation again...
scalar: not vector - only callable for non-array allocations
deleting: frees memory associated with the single instance
destructor: executes the destructor code for the class
I suspect that the compiler generates this entry point for the purpose =
of destroying and freeing memory associated with a single (non-array) =
instantiation of the class.
-----
Stuart Downing
sdowning@fame.com
FAME Information Services, Inc.
-----From: (Associate)
Okay, this is really beginning to piss me off.
fix the problem. I got an unsubscribe notice a few hours
ago but apparently something else is happening.
this is of NO use to me:
"Folbrecht, Paul B" Wrote:
|
|
|
|
| Paul B Folbrecht
| 03/31/97 04:12 PM
|
|
|
| Environment: VC++ 4.1, Win95
|
| I have a CView-derived object that causes an
| assertion on line 1018 of
| dbgheap.c on deletion (it's using auto-delete as
| normal).
|
| Here's the line:
|
| _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
|
| The stack looks like this:
|
| _free_dbg_lk(int 4, void * 0x00a8a478) line 1017 +
| 102 bytes
| _free_dbg(int 4, void * 0x00a8a478) line 970 + 13
| bytes
| CObject::operator delete(void * 0x00a8a478) line 44 +
| 12 bytes
| CSummaryGrid::`scalar deleting destructor'() + 39
| bytes
| CView::PostNcDestroy() line 120 + 35 bytes
| CWnd::OnNcDestroy() line 831
| CWnd::OnWndMsg(unsigned int 130, unsigned int 0, long
| 0, long *
| 0x00a6edac) line 1838
| CWnd::WindowProc(unsigned int 130, unsigned int 0,
| long 0) line 1617 +
| 30 bytes
| AfxCallWndProc(CWnd * 0x00a8a478 {CObject}, HWND__ *
| 0x0000030c,
| unsigned int 130, unsigned int 0, long 0) line 209 +
| 26 bytes
| AfxWndProc(HWND__ * 0x0000030c, unsigned int 130,
| unsigned int 0, long
| 0) line 362 + 25 bytes
| AfxWndProcBase(HWND__ * 0x0000030c, unsigned int 130,
| unsigned int 0,
| long 0) line 176 + 21 bytes
| KERNEL32! bff73663()
| KERNEL32! bff928e0()
| 00007efa()
| 058f64c9()
|
| The class declares a virtual destructor that does
| nothing. There's
| nothing at all out of the ordinary that I can see.
|
| As an aside, can anyone explain to me the purpose of
| "scaling deleting
| destructors"?
|
| -Paul Folbrecht
| Compuware Corp.
|
|
|
Mike Blaszczak -- mikeblas@nwlink.com
Tuesday, April 01, 1997
[Mini-digest: 4 responses]
At 14:21 4/1/97 -0500, Stuart Downing wrote:
>> As an aside, can anyone explain to me the purpose of "scaling >deleting
>> destructors"?
>
>Speculation again...
>scalar: not vector - only callable for non-array allocations
>deleting: frees memory associated with the single instance
>destructor: executes the destructor code for the class
Yep. It turns out that the compiler might coalsesce the vector deleting
destructor and the scalar deleting destructor into the same code,
which shaves of a bunch of bytes per destructor. All this means that
the symbol actually points at some glue code that has a loop or a prepared
call to your real destructor, but that's what the symbol does.
>-----From: (Associate)
>
>Okay, this is really beginning to piss me off.
>fix the problem. I got an unsubscribe notice a few hours
>ago but apparently something else is happening.
>
>this is of NO use to me:
_Man_, am _I_ glad I don't wear trendy, overpriced clothing.
(By the way, your catalog request page can't decide if the
catalog is 125 pages or 130 pages long. Is _that_ of some use
to you?)
.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
One is too many and a million is not enough.
-----From: Mike Blaszczak
At 16:12 3/31/97 -0500, Folbrecht, Paul B wrote:
> Environment: VC++ 4.1, Win95
> I have a CView-derived object that causes an assertion on line 1018 of
> dbgheap.c on deletion (it's using auto-delete as normal).
>
> Here's the line:
> _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
>
Generally, this assert means that you're deleting memory that's
already been deleted. Sometimes, it means that you're deleiting memory
that you don't own in the first place, but that cause isn't very common.
> The stack looks like this:
>
> _free_dbg_lk(int 4, void * 0x00a8a478) line 1017 + 102 bytes
> _free_dbg(int 4, void * 0x00a8a478) line 970 + 13 bytes
> CObject::operator delete(void * 0x00a8a478) line 44 + 12 bytes
> CSummaryGrid::`scalar deleting destructor'() + 39 bytes
> CView::PostNcDestroy() line 120 + 35 bytes
> CWnd::OnNcDestroy() line 831
> CWnd::OnWndMsg(unsigned int 130, unsigned int 0, long 0, long *
> 0x00a6edac) line 1838
Your CView wants to delete itself when it gets the WM_NCDESTROY message.
I can't tell from this stack dump if your CView "is-a" or if it "has-a"
CSummaryGrid object, but it appears that some object your CSummaryGrid
class owns was previously deleted and is being deleted again.
> The class declares a virtual destructor that does nothing. There's
> nothing at all out of the ordinary that I can see.
Which class is "the class"?
.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
One is too many and a million is not enough.
-----From: mzinner@berlin.snafu.de
> _free_dbg_lk(int 4, void * 0x00a8a478) line 1017 + 102 bytes
> _free_dbg(int 4, void * 0x00a8a478) line 970 + 13 bytes
> CObject::operator delete(void * 0x00a8a478) line 44 + 12 bytes
> CSummaryGrid::`scalar deleting destructor'() + 39 bytes
> CView::PostNcDestroy() line 120 + 35 bytes
you probably have a member
CSummaryGrid m_summaryGrid;
in your view. You get the assertion when this summary grid is
destroyed. Does this summary grid have an explicit destructor?
-manfred
-----From: Gareth Glendinning
Environment: VC++ 4.1, Win95
I had a similar assertion caused by over-running when writing to a buffer. I was calling an RPC function with a buffer parameter which it modifies (but it could have been any function call passing a buffer on the stack (not a pointer)). My function overran the buffer, not enough to tread on guard blocks (and cause an exception) but enough to do some damage to the heap. You might want to see if you're calling any function with such parameters up to that point. In short, it's not a problem with your destructor, it's historical.
Paul B Folbrecht
03/31/97 04:12 PM
Environment: VC++ 4.1, Win95
I have a CView-derived object that causes an assertion on line 1018 of
dbgheap.c on deletion (it's using auto-delete as normal).
Here's the line:
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
The stack looks like this:
_free_dbg_lk(int 4, void * 0x00a8a478) line 1017 + 102 bytes
_free_dbg(int 4, void * 0x00a8a478) line 970 + 13 bytes
CObject::operator delete(void * 0x00a8a478) line 44 + 12 bytes
CSummaryGrid::`scalar deleting destructor'() + 39 bytes
CView::PostNcDestroy() line 120 + 35 bytes
CWnd::OnNcDestroy() line 831
CWnd::OnWndMsg(unsigned int 130, unsigned int 0, long 0, long *
0x00a6edac) line 1838
CWnd::WindowProc(unsigned int 130, unsigned int 0, long 0) line 1617 +
30 bytes
AfxCallWndProc(CWnd * 0x00a8a478 {CObject}, HWND__ * 0x0000030c,
unsigned int 130, unsigned int 0, long 0) line 209 + 26 bytes
AfxWndProc(HWND__ * 0x0000030c, unsigned int 130, unsigned int 0, long
0) line 362 + 25 bytes
AfxWndProcBase(HWND__ * 0x0000030c, unsigned int 130, unsigned int 0,
long 0) line 176 + 21 bytes
KERNEL32! bff73663()
KERNEL32! bff928e0()
00007efa()
058f64c9()
The class declares a virtual destructor that does nothing. There's
nothing at all out of the ordinary that I can see.
As an aside, can anyone explain to me the purpose of "scaling deleting
destructors"?
-Paul Folbrecht
Compuware Corp.
Garp
Become an MFC-L member
| Вернуться в корень Архива
|