473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

BUG: Wrong Operator Delete Called for Exported

This topic was widely discussed before but somehow I still have no idea how
to fix the problem.

I've a C++ class which resides inside DLL and has some STL members inside.
The EXE uses STL vector of my classes and get run time crash on the
destructors in the RTLValidateHeap function.
The knowledge base Q122675 article explains the situation. However the
solution offered by Microsoft on declaring constructor and destructor inline
does not work. I have the problem on Intel Compiler and STLPort's version of
STL.

Best Regards,
Dmitri Zhukov.
Jul 19 '05 #1
4 5858

"Dmitri Zhukov" <di*******@mail.ru> wrote in message
news:be**********@alpha2.radio-msu.net...
This topic was widely discussed before but somehow I still have no idea how to fix the problem.

I've a C++ class which resides inside DLL and has some STL members inside.
The EXE uses STL vector of my classes and get run time crash on the
destructors in the RTLValidateHeap function.
The knowledge base Q122675 article explains the situation. However the
solution offered by Microsoft on declaring constructor and destructor inline does not work. I have the problem on Intel Compiler and STLPort's version of STL.

You'd be much better off looking on the microsoft news server
(news.microsoft.com) for a newsgroup that can address this issue. This is
VERY Microsoft-specific stuff! (For one thing, we haven't the faintest idea
what that problem or solution was that you mention, so we've no way to
comment on how it might or might not help you.)

-Howard
Jul 19 '05 #2

"Howard" <al*****@hotmail.com> wrote in message
news:be********@dispatch.concentric.net...

"Dmitri Zhukov" <di*******@mail.ru> wrote in message
news:be**********@alpha2.radio-msu.net...
This topic was widely discussed before but somehow I still have no idea how
to fix the problem.

I've a C++ class which resides inside DLL and has some STL members inside. The EXE uses STL vector of my classes and get run time crash on the
destructors in the RTLValidateHeap function.
The knowledge base Q122675 article explains the situation. However the
solution offered by Microsoft on declaring constructor and destructor

inline
does not work. I have the problem on Intel Compiler and STLPort's

version of
STL.
You'd be much better off looking on the microsoft news server
(news.microsoft.com) for a newsgroup that can address this issue. This is
VERY Microsoft-specific stuff! (For one thing, we haven't the faintest

idea what that problem or solution was that you mention, so we've no way to
comment on how it might or might not help you.)
I don't see it this as a MS speciffic issue. It's a common hassle when
exchanging objects across "build" bounderies. Under Windowze, this is
typically between an exe and a dll or between dlls. On an another os this
may involve shared libraries instead.
Whatever, lets call it an Execution Unit (EU) for the sake of the argument.
Every EU will tend to have its own copy of the runtime libraries and c++
memory manager statically linked in and this is the core of the issue. You
get multiple housekeepings.
If you create a std::string in one of these and pass it on for manupulation
across EU, the chances are it'll get damaged. There is no way one typical
c++ memory manager can free a block allocated by another memory manager even
though both run in the same address space, unless, they'd be allocating
everything on the system heap in which case there would be no need for them
at all. Expect your app to slow down considerably though in that case.
Windows has system wide object like _bstr_t (yes, ms specific) to allow for
the safe exchange of strings across EUs.
In general, the trick is to make sure that within one application's process
space, only one central memory manager is used. You can do that by
implementing your own new and delete and malloc and free variants and
exposing these from a singular EU that every other EU must link to or you
could for example use a commercial product like SmartHeap to do this for you
(available on several platforms). A specific class exposed from one EU can
also deal with this by overloading operator new, delete, new[], delete[] and
their throw (nothrow) variants. MFC does this a.f.a.i.k in CObject. This
forces an mfc instance to get newed and deleted from inside the mfc dll.
On a larger system with many EUs, frankly, my advise is to go for a thing
like SmartHeap (you get a lot more than merely centralized memory manager).
It pays in the long run.

h.t.h. somewhat :-)
Conrad Weyns.

-Howard

Jul 19 '05 #3

"Conrad Weyns" <we***@online.no> wrote in message
news:mQ*******************@news4.e.nsc.no...

"Howard" <al*****@hotmail.com> wrote in message
news:be********@dispatch.concentric.net...

"Dmitri Zhukov" <di*******@mail.ru> wrote in message
news:be**********@alpha2.radio-msu.net...
This topic was widely discussed before but somehow I still have no
idea
how
to fix the problem.

I've a C++ class which resides inside DLL and has some STL members inside. The EXE uses STL vector of my classes and get run time crash on the
destructors in the RTLValidateHeap function.
The knowledge base Q122675 article explains the situation. However the
solution offered by Microsoft on declaring constructor and destructor

inline
does not work. I have the problem on Intel Compiler and STLPort's

version
of
STL.

You'd be much better off looking on the microsoft news server
(news.microsoft.com) for a newsgroup that can address this issue. This

is VERY Microsoft-specific stuff! (For one thing, we haven't the faintest

idea
what that problem or solution was that you mention, so we've no way to
comment on how it might or might not help you.)


I don't see it this as a MS speciffic issue. It's a common hassle when
exchanging objects across "build" bounderies. Under Windowze, this is
typically between an exe and a dll or between dlls. On an another os this
may involve shared libraries instead.


Well, since he's talking about a Microsoft knowledge base article that deals
with a DLL, running under Windows, and since we have no idea what that
article describes as the problem or solution, wouldn't you think that their
newsgroups might be a better source of info on how to fix this particular
problem than a newsgroup devoted to the C++ language?

(And a little more info than what was provided would also be
helpful...nobody should have to go hunting for a MS knowledge-base article
just to answer somebody else's question.)

-Howard



Jul 19 '05 #4
On Thu, 3 Jul 2003 22:58:31 +0200, "Conrad Weyns" <we***@online.no>
wrote in comp.lang.c++:

"Howard" <al*****@hotmail.com> wrote in message
news:be********@dispatch.concentric.net...

"Dmitri Zhukov" <di*******@mail.ru> wrote in message
news:be**********@alpha2.radio-msu.net...
This topic was widely discussed before but somehow I still have no idea

how
to fix the problem.

I've a C++ class which resides inside DLL and has some STL members inside. The EXE uses STL vector of my classes and get run time crash on the
destructors in the RTLValidateHeap function.
The knowledge base Q122675 article explains the situation. However the
solution offered by Microsoft on declaring constructor and destructor

inline
does not work. I have the problem on Intel Compiler and STLPort's

version
of
STL.

You'd be much better off looking on the microsoft news server
(news.microsoft.com) for a newsgroup that can address this issue. This is
VERY Microsoft-specific stuff! (For one thing, we haven't the faintest

idea
what that problem or solution was that you mention, so we've no way to
comment on how it might or might not help you.)


I don't see it this as a MS speciffic issue. It's a common hassle when
exchanging objects across "build" bounderies. Under Windowze, this is
typically between an exe and a dll or between dlls. On an another os this
may involve shared libraries instead.


Doesn't make it any less off-topic because operating systems other
than Windows have similar issues. It is still off-topic. The C++
language does not define libraries at all, let alone dynamic or shared
ones.

It is just plain and simply not a language issue.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Ioannis Vranos | last post by:
When we use the standard placement new operator provided in <new>, and not a definition of owr own, isn't a call to placement delete enough? Consider the code: #include <new>
11
by: Jonan | last post by:
Hello, For several reasons I want to replace the built-in memory management with some custom built. The mem management itlsef is not subject to my question - it's ok to the point that I have...
6
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
1
by: Tony Johansson | last post by:
This class template and main works perfectly fine. But could be better. I have this class template called Handle that has a pointer declared as T* body; As you can see I have a reference counter...
15
by: rlayberry | last post by:
Hi I have found what looks like a huge bug in MSAccess. When I have the following in a table in Access 1996 0.08715292
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 378 open ( +3) / 3298 closed (+34) / 3676 total (+37) Bugs : 886 open (-24) / 5926 closed (+75) / 6812 total (+51) RFE : 224 open...
6
by: Lighter | last post by:
Big Problem! How to overload operator delete? According to C++ standard, "A deallocation function can have more than one parameter."(see 3.7.3.2); however, I don't know how to use an overloaded...
8
by: gw7rib | last post by:
I've been bitten twice now by the same bug, and so I thought I would draw it to people's attention to try to save others the problems I've had. The bug arises when you copy code from a destructor...
2
by: helraizer1 | last post by:
Hi folks, I have a file for my chatbox called data.line, which the posts are in the layout CHATBOXTEXT 7 username=helraizer 1202416953
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.