Solved

Freeing Allocated Memory

Posted on 2000-03-30
6
227 Views
Last Modified: 2013-11-20
Is there a known problem where memory is allocated (via malloc) in a C Based DLL, passing the allocated memory address back to an appication thru a callback function setting the address as an LParam? What seems to be happening (using NT) is that MFC application crashes whenever the application frees the memory (LParam Address) using free.
0
Comment
Question by:nweiher
6 Comments
 
LVL 4

Expert Comment

by:captainkirk
ID: 2670830
The memory allocated in the DLL is from its own memory pool unless it is an MFC Extension DLL. You may want to see if you can free the memory inside the DLL.
0
 
LVL 8

Expert Comment

by:gelbert
ID: 2670861
Possible problem could be that MFC app and your C dll were compiled with different versions of C runtime library
0
 
LVL 2

Accepted Solution

by:
DKostov earned 500 total points
ID: 2671069
Here the problem is basicly the same.
You can see some guidelines about the possible resolution.

http://www1.experts-exchange.com/bin/Q.10261061

captainkirk & gelbert are totally right.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2672396
Under debug - MFC uses a different malloc to that in release to enable it to do memory tracking. so mixing release and debug MFC builds can cause problems the same may also apply to 'vanilla' C dlls also.

0
 
LVL 3

Expert Comment

by:Try
ID: 2672562
"DKostov", since you were the one who answered the question at the address you've given, why not simply copy it over here!
0
 
LVL 2

Expert Comment

by:DKostov
ID: 2673864
"Try",
The discussion there is huge.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 168
ASCII Non-Printable characters/codes and their HTML equivalents 6 143
substring method in java 1 135
wordcount challenge 11 144
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question