Re: Problem with memory allocation
- From: "Tom Serface" <tom.nospam@xxxxxxxxxxxxx>
- Date: Wed, 2 May 2007 09:58:59 -0700
I've never seen this problem, but since you mention that you have multiple threads maybe more than one thread is trying to update the data at the same time. Or, perhaps you're running into a reference counting problem and you really are running out of memory from simply allocating the string (fresh) over and over.
Tom
"Punit Kaur" <Punit Kaur@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:0D8E7195-9798-471C-831E-F8F383847DBD@xxxxxxxxxxxxxxxx
Hi,
I have a multi-threaded application where in one of the functions that is
called inside one of the threads, I have declared a CString variable called
ErrorText. I leave the application to run overnight in the Debug mode.
Somehow, the application runs successfully for a few hours and then freezes
at a random time and displays a message box " User Breakpoint called from
code at 0x10212ad0". I see this message when I come back in the morning. It
stops at one of the statements in dbgheap.c... then I step through the code
and it goes through many functions of which one of them is a CString function
AllocBuffer. After stepping through all the code in the library, it returns
to the function where the following line was called:
ErrorText = "Some String";
I believe this assignment statement is causing some memory allocation
problems. I am also not sure if there are any memory leaks in my application.
I remember another problem in the past, where this string was overwriting
another string. To solve that problem, I just had to initialize that
variable's memory using memset and it started working fine...
Has someone seen such problems before? If yes, please suggest what I should
do. I would also like to understand the memory allocation stuff... I shall
post the function if anybody wants to have a look at it.
.
- Follow-Ups:
- Re: Problem with memory allocation
- From: Punit Kaur
- Re: Problem with memory allocation
- Prev by Date: Re: Interesting problem when hiding main window
- Next by Date: Re: Accelerator key not working
- Previous by thread: Re: Modeless dialog box in a thread
- Next by thread: Re: Problem with memory allocation
- Index(es):
Relevant Pages
|