Solved

Freeing Allocated Memory

Posted on 2000-03-30
6
194 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now