Solved

Freeing Allocated Memory

Posted on 2000-03-30
6
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Macro to save highlighted rows as a separate file 5 51
Expand macro to ask for filename column 8 40
Looking for a specific application/software 2 124
wordcount challenge 11 164
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

751 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