473,805 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

_CrtIsValidHeap Pointer(pUserDa ta) in dbghelp.c

When I execute my program (it's multithread and has COM and dll),
there is an error message as follows:

Program D:\dongle_1\Tes tAP\bin\Debug\T estAP.exe
File: dbgheap.c
Line: 1132
Expression: _CrtIsValidHeap Pointer(pUserDa ta)
For information on how your program can cause an assertion failure, see
the Visual C++ documentation on asserts.
=============== =============== =============== =====
I read the dbgheap.c and find the line 1132, it's as follows:
/*
* If this ASSERT fails, a bad pointer has been passed in. It
may be
* totally bogus, or it may have been allocated from another
heap.
* The pointer MUST come from the 'local' heap.
*/
1132: _ASSERTE(_CrtIs ValidHeapPointe r(pUserData));
=============== =============== =============== =============== =I also use
google to find some answers.
They said
(1) If you are developing multithread application, be sure to link it
with
the correct runtime library(/MD, /MT). That what
"The pointer MUST come from the 'local' heap." means.
Check what "ruintime library" you use. It should be "Multi threaded (
debug ) DLL"

Roman

(2)
Not only must they match, they must both be DLL versions. If they're
static versions, each piece (the exe and the dll) will have their own
heap and the OP will still be deleting from mismatched heaps.
I'd also be suspicious of general design issues given the way the OP's
main program is having to clean up for the dll.

You'll get this problem if you use two different run-time libraries,
one to
allocate the memory and one to de-allocate the memory. Open up the
project
settings dialog, switch to C/C++ tab, set Category to Code Generation
and
check the Use run-time library combo box. These must match in any
modules
that share the task of allocating and destroying memory.
--
Randy Charles Morin
Author of Programming Windows Services
http://www.kbcafe.com
=============== =============== =============== ========
If necessary, my dirty code is as follows (Please read from the bottom
up)
http://irc.csie.org:8888/125

Thanks in advance .

-jiing-

Nov 17 '05 #1
0 1619

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

Similar topics

1
2166
by: Morten Lind | last post by:
Hello I'm having a problem with some DLL, that I wrote, and a test application using it, which I also wrote. In the DLL some class A is defined and exported. I have no problem using it in the test application. Also in the DLL there is a class B which has a method of the kind void B::getSomeAs(vector<A>& aContainer)
5
1255
by: cai | last post by:
Hi ,everyone, I come up with a problem, and I struggle with it for time , but I can't find the answer out. I got a dll file like this: /////////dll file//////// typedef struct tagIEPROXY { DWORD dwProxyEnable; #ifdef UNICODE wstring strProxyOverride;
5
1574
by: LabRat | last post by:
I've been working lately to build a dynamic library (in this case, a win32 dll) and I have encountered huge problems with it. This is my first real attempt at doing anything like this, so it's been a learning experience for me. I have gotten the dll to build completely, but now I'm having a hard time getting the application using it to run. When I run the executable I've made it generates runtime errors: Debug Assertion Failed!...
0
5542
by: jiing | last post by:
When I execute my program (it's multithread and has COM and dll), there is an error message as follows: Program D:\dongle_1\TestAP\bin\Debug\TestAP.exe File: dbgheap.c Line: 1132 Expression: _CrtIsValidHeapPointer(pUserData) For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. ==================================================
13
8792
by: Schizoid Man | last post by:
Hi, I have defined a very simple class as follows. I initialize the CInventory object as: CInventory *itemInveotry; The program just performs two functions - it reads the total number of items and values of itemNumber, quantity and cost per item from the user, and it prints these values back. While printing these values, I get a _CrtIsValidHeapPointer(pUserData)
3
1738
by: Maxim | last post by:
Hi all, I'm trying to use ATL (CString, CCOMSafeArray, etc.) classes in managed C++ code, but I get the following assert exeption when I start the application: Debug Assertion Failed: Expression: _CrtIsValidHeapPointer(pUserData) in file dbgheap.c
6
10394
by: =?Utf-8?B?R29yZG8=?= | last post by:
Hello everyone, I've been trying for some time now to move to C++/CLI, but I have several large legacy C++ static libraries I need to use. When I set up a simple solution with a C++/CLI Winforms app and a C++ native static library, they work well together _unless_ I have, it seems, any static variables defined in any function in the native library. The libraries I'm trying to use all have Meyers Singletons in them, so they need to have...
3
2009
by: =?Utf-8?B?SnNDaGFybHk=?= | last post by:
Hello, My application is using a Dll loaded with the function "LoadLibrary(<NameOfTheDll>)" In the dll there is the following fonction : char * GetMessageError(int Error) {
1
1875
by: kphip123 | last post by:
Hi! I recently converted an application from VS2003 to VS2005. The application consists of a main 'unmanaged C++ executable' which calls a managed C++ .dll. The .dll basically launches a separate form. The application use to work fine in VS2003. Now that I have converted to VS2005 the main executable is working but an exception gets thrown when it trys to call the .dll (basically the new separate form
0
9716
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
9596
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
10360
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
10366
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
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4323
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
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.