Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"scalar deleting destructor"

4,354 views
Skip to first unread message

Kelli

unread,
Apr 1, 1997, 3:00:00 AM4/1/97
to

Hello all!

Has any one seen this error ("scalar deleting destructor") in the call
stack? I've found two old KB articles, neither of which seem to apply
to what I'm doing. I'm not in a DLL and I'm using verion 4.2b.

I think I'm doing something pretty simple. I have a class derived from
CObject that contains a CString object. Any time I delete these light
weight objects (after 'new'ing them) I get the "scalar deleting
destructor" on the call stack.

Any tips and/or pointers ;) would be *greatly* appreciated.
Thank you very much,
Kelli

--
ke...@inlet.com
http://www.inlet.com

Joseph M. O'Leary

unread,
Apr 1, 1997, 3:00:00 AM4/1/97
to

Make sure the destructor of your derived class is declared as virtual.

Kelli <ke...@inlet.com> wrote in article <33414F...@inlet.com>...

Kelli

unread,
Apr 2, 1997, 3:00:00 AM4/2/97
to

I found some possible distrubing news: If you set a break point on a
wizard created project's View destructor, it has a "scalar deleting
destructor" message on the call stack. That's with none of my code in
there.

I checked, and all destructors are virtual. (Both for the CView base
and derived classes and my classes.) Is this a bogus message? Or is
there something truely wrong here?

Thanx for your time,
Kelli

Ronald M. Martin

unread,
Apr 2, 1997, 3:00:00 AM4/2/97
to ke...@inlet.com

Kelli,

What makes you feel that this is an error. Scaler deleting destructors
are created by the compiler whenever you use the delete operator. If
you have set a breakpoint in the middle of code which is doing a delete,
you are likely to see this synthetic function name on the return stack.

Ron Martin
Ann Arbor, MI

Kelli

unread,
Apr 2, 1997, 3:00:00 AM4/2/97
to cpu...@mindspring.com

Ronald M. Martin wrote:
>
> Kelli,
>
> What makes you feel that this is an error. Scaler deleting destructors
> are created by the compiler whenever you use the delete operator. If
> you have set a breakpoint in the middle of code which is doing a delete,
> you are likely to see this synthetic function name on the return stack.
>
> Ron Martin
> Ann Arbor, MI

I think I got started on this when I had a GPF and the only thing (at
the time) I could see was the Scalar Deleting Destructor that looked out
of place. The only thing I could find on it was two KB articles talking
about this being an error. I've done a little more looking and now can
see that I shouldn't be concerned about it, it was never part of my
problem.

Thank you for your time and response,

Richard Lewis Haggard

unread,
Apr 3, 1997, 3:00:00 AM4/3/97
to

What the heck is a scalar deleting destructor, anyway? Although I've been
the victum of this warning/error before I've never understood what it was.
The phraseology is such that I can't even hold the words in my head for 5
seconds, little alone derive any sort of meaning from them.
--
Richard Lewis Haggard
hag...@world.std.com
Haggard & Associates, International

J.T. Anderson

unread,
Apr 3, 1997, 3:00:00 AM4/3/97
to

Richard Lewis Haggard wrote:
>
> What the heck is a scalar deleting destructor, anyway? Although I've been
> the victum of this warning/error before I've never understood what it was.
> The phraseology is such that I can't even hold the words in my head for 5
> seconds, little alone derive any sort of meaning from them.

It's neither an error nor a warning. It's a function the compiler
generates to implement the delete operator. It calls the object's
destructor, then frees the object's memory. If you new and delete
arrays of objects, you will see the "vector deleting destructor"
instead.

The scalar deleting destructor takes a flag parameter on the stack that
tells it whether or not to free the memory. I seem to recall reading
about a bug in some versions of VC++ where, if you used placement new to
create an object, then explicitly invoked its destructor, it would call
the scalar deleting destructor, but without pushing the flag parameter.
This would both mess up the stack, and pseudo-randomly try to free the
object's memory.
--
J.T. Anderson
PLATINUM technolgy, Los Angeles Laboratory
jtand...@platinum.com

Richard Lewis Haggard

unread,
Apr 3, 1997, 3:00:00 AM4/3/97
to

Thank you for your reply. I guess it is the terminology that is giving me
difficulty. The meaning of the message is not easy to discern. Why is it
called scalar? Why is the other called a vector? A scalar to me is
something that is linearly arranged in regular periodic units. A vector is
means to express a direction combined with a magnitude.

In my cases, I've seen these messages pop up on the debug window saying to
the effect,
"warning. scalar delete destructor called in window distructor. Base class
distructor will not be called."


--
Richard Lewis Haggard
hag...@world.std.com
Haggard & Associates, International

> It's neither an error nor a warning. It's a function the compiler

Scott Gilbert

unread,
Apr 3, 1997, 3:00:00 AM4/3/97
to

Richard Lewis Haggard <hag...@world.std.com> wrote in article
<01bc4059$b3075340$5234...@dell90.vivo.com>...


> Thank you for your reply. I guess it is the terminology that is giving me
> difficulty. The meaning of the message is not easy to discern. Why is it
> called scalar? Why is the other called a vector? A scalar to me is
> something that is linearly arranged in regular periodic units. A vector
is
> means to express a direction combined with a magnitude.
>

In mathematics, scalar multiplication is when you multiply a vector (or
matrix) times a single "real" number. Vectors are (linear) ordered
collections of real numbers. So scalar is singular and vector is plural.

0 new messages