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

Home Posts Topics Members FAQ

[help]_CrtIsValidHeap Pointer(pUserDa ta) in dbgheap.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 5541

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

Similar topics

0
1111
by: scott_wu | last post by:
Greeting: I use dotnet2003(DB:Mysql data provider: MySQLDriverCS1 socket: easysocket) after compile release and run on win2000 I got dbgheap.c 1132 expression : _crtisvalidheappointer (pUserData) And my application is dead My another application memory will increase very quickly Could anyone guide me where I could start to trace what cause this Any suggestion is appreciated Scott_Wu
2
2153
by: kenc | last post by:
Please help with this bug, probably due to CRT not starting up. To recreate: In VS2005 create a new C++ "Windows Form Application" Add the line #include <atlbase.h> in stdafx.h (or anywhere else) I get the following error: --------------------------- Microsoft Visual C++ Debug Library ---------------------------
1
1693
by: Pascalus | last post by:
Hi there! I have a problem with the delete operator to destroy a (char*). It used to work since today. I don't know what I may have changed in the project and/or the solution (probably in the properties or what) to cause this problem... I have an app written in cpp.NET. In one function, I call an external function from a win32 DLL of my own. Here is the body: #include "myDll.h" void myCppNetFunction(...) { char* str = NULL;
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
2978
by: dreiko466 | last post by:
(sorry about my english...) I am a newbie in C (3 month expierience) I have wrote a simple test programm in VS2005, what i do wrong?Please... In this programm i create a double linked list.Then pass its first block pointer inside the structure Array to Array ->first and the last block pointer inside the structure Array to Array ->last.So i can manipulate the double linked list as a dynamic array. The cells of this dynamic array are...
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
1870
by: =?Utf-8?B?REx1ZWNr?= | last post by:
I am getting a debug assertion error that reads: Debug Assertion Failed! program E:\program files\internet explorer\iexplore,exe File: dbgheap.c Line: 1252 Expression: _CrtIsValidHeapPointer(pUserData)
0
10359
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
10364
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
10104
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
9182
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
7645
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
6875
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();...
0
5541
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...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
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

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.