473,791 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5888

"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*****@hotmai l.com> wrote in message
news:be******** @dispatch.conce ntric.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.n o> wrote in message
news:mQ******** ***********@new s4.e.nsc.no...

"Howard" <al*****@hotmai l.com> wrote in message
news:be******** @dispatch.conce ntric.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...nobod y 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.n o>
wrote in comp.lang.c++:

"Howard" <al*****@hotmai l.com> wrote in message
news:be******** @dispatch.conce ntric.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.l earn.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
4155
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
912
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 nice and working allocation deallocation routines. However, I don't want to loose the nice extras of new operator, like - constructor calling, typecasting the result, keeping the array size, etc. For another bunch of reasons, outside this scope I...
6
2582
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 "SEGV" when run (presumably - attempt to delete deleted memory. Please take a look and see if you can notice any mistakes I'm making. Basically, I want to store classes of my objects in a vector. I also have three further questions:
1
1711
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 in the class template so I know how many references I have to the body. In my case it's the Integer wrapper class which is the body. This template works for many different types. The one that I use is named Integer and is a Wrapper for an int....
15
2401
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
361
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 ( +7) / 227 closed ( +7) / 451 total (+14) New / Reopened Patches ______________________
6
12470
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 delete operator. Let me use an example to illustrate this: /********************************************************/ #include <new> #include <iostream>
8
2058
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 to use elsewhere. For example, suppose you have a class Note. This class stores some text, as a linked list of lines of text. The destructor runs as follows: Note::~Note() {
2
1492
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
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.