Re: malloc



ramu wrote:
Hi,
Will the memory allocated by malloc and realloc be contiguous?

regards

Do you mean across seperate calls? If so, then no. The standard makes
no such guarantee. If you want such a feature, (why?), then you'll have
to roll your own allocator.

.



Relevant Pages

  • Re: Kick off your 2006 campaign with a race in Brussels
    ... As regards Caroline's concerns, who knows what the standard will be? ... If we manage to attract all the best Belgian crews we can expect the ... > For those who think Brussels is a long way to go. ...
    (rec.sport.rowing)
  • Re: printf("%p ", (void *)0);
    ... Not by a C standard, ... > It may still be true, on some implementations. ... So realloc() is explicitly defined to not handle stale pointers? ...
    (comp.lang.c)
  • Re: printf("%p ", (void *)0);
    ... > This poses serious implications for realloc(). ... Not by a C standard, ... on some implementations. ... ptr1 as an lvalue but doesn't use the lvalue to read the stored value. ...
    (comp.lang.c)
  • Re: Torture Standard
    ... >Comes back the debate on the standard of conduct as regards 'torture'- ... >No resolution to existing rules- gots to apply to everybody, ...
    (rec.martial-arts)
  • Re: when can realloc fail?
    ... will the allocation of ptr be freed? ... about what the Standard requires/allows. ... memory pointed to by p, basing the claim on the deallocation ... Don't call realloc() with the second ...
    (comp.lang.c)