Dynamic Allocation Problem.....

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.


.



Relevant Pages

  • Re: This calculation is just wrong / computer cant count!
    ... and I replied "new or malloc". ... It is not the fastest way to allocate memory". ... think that VirtualAlloc is faster than malloc has some serious issues, ... then there is no error only a precision limit. ...
    (microsoft.public.vc.mfc)
  • Re: difference between malloc and calloc?
    ... malloc(), and that's the opportunity for a tiny bit of sanity- checking. ... Here are two ways you might try to allocate memory to ... calloc() almost never. ... There is no special dispensation for overflow of nmemb * size; there is just the requirement for a NULL returned value. ...
    (comp.lang.c)
  • Re: difference between malloc and calloc?
    ... malloc(), and that's the opportunity for a tiny bit of sanity- checking. ... Here are two ways you might try to allocate memory to ... calloc() almost never. ... void *p = malloc; ...
    (comp.lang.c)
  • Dynamic Allocation Issues...
    ... malloc() to allocate memory for the Pointer variables. ... and hence it leads to Unhandled Exception. ...
    (microsoft.public.vc.ide_general)
  • Dynamic Allocation Problem...
    ... malloc() to allocate memory for the Pointer variables. ... and hence it leads to Unhandled Exception. ...
    (microsoft.public.win32.programmer.kernel)