Re: Dynamic Allocation Problem...
- From: "Ivan Brugiolo [MSFT]" <ivanbrug@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 May 2005 07:21:57 -0700
The only legitimate failure from malloc() is a NULL pointer, and,
this happens when your process is out of memory.
In all other cases, your application must have corrupted the internal state
of the heap, and your code enters the reign of the undefined behavior.
Please compiler your application in release mode, and run it under
debugger after having enabled full page heap.
c:\debuggers>gflags -p /enable InDevelopmentApp.exe /full
c:\debuggers>start cdb -g -G InDevelopmentApp.exe
The heap instrumentation activated by gflags.exe is likely to put you
very close to the place where the corruption has happened.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Muthukumar" <muthu@xxxxxxxxxxxxxx> wrote in message
news:eJMnB7dYFHA.3712@xxxxxxxxxxxxxxxxxxxxxxx
> Dear Pals,
>
> Query 1:
>
> In my Win32 console application using Microsoft C compiler, I am using
> malloc() to allocate memory for the Pointer variables. These allocations
are
> working very fine, but sometimes malloc() failed to allocate memory and
> gives Unhandled Exception error. Pointer variable has no allocated memory
> and hence it leads to Unhandled Exception.
>
> Could you please tell me in which cases malloc get fails to allocate
memory?
> How to resolve this issue as a permanent?
>
> Query 2:
> During the deallocation time using the free() , I am getting the
"Debug
> Assertion failed" error in some cases. What might be the reason for
getting
> this Error? Could you please give the better solution.
>
> Earliest replies are very much appreciated.
>
> Regards,
> Shahul.
>
>
.
- References:
- Dynamic Allocation Problem...
- From: Muthukumar
- Dynamic Allocation Problem...
- Prev by Date: Re: How to determine if a handle refers to a 16-bit process
- Next by Date: Re: Trapping Another Process' Messages
- Previous by thread: Dynamic Allocation Problem...
- Index(es):
Relevant Pages
|