Re: malloc
- From: "santosh" <santosh.k83@xxxxxxxxx>
- Date: 6 Dec 2006 07:57:35 -0800
milinddeore@xxxxxxxxx wrote:
santosh wrote:<snip>
ramu wrote:
<snip>If I use both the calls ie. malloc and realloc together, how the allocated memory will be
ie. contiguous or not?
<snip>2.
double *d1 = malloc(100 * sizeof *d1);
double *d2 = realloc(d2, 100 * sizeof *d2);
Here the elements of d1 have no necessary relationship with elements of
d2, i.e. pointer arithmetic will not work _across_ them, though within
each block, elements can be regarded as contiguous.
$$ Good mathematics, but of no use.
Are you disputing the statement that elements within a single
allocation of memory in standard C can be _regarded_ as contiguous?
What if brk/sbrk gives new pages, as the old page is over.
The C standard says nothing about 'brk/sbrk'.
For your information pages are just the
virtual mapping and not guaranteed that they will come contiguous
memory manner.
For your information 'virtual memory' and paging are neither required
by the standard, nor likely to be present on a lot of conforming
implementations.
DOS and embedded systems are the most obvious counter examples.
.
- References:
- malloc
- From: ramu
- Re: malloc
- From: santosh
- Re: malloc
- From: ramu
- Re: malloc
- From: santosh
- Re: malloc
- From: milinddeore
- malloc
- Prev by Date: Re: malloc
- Next by Date: Re: trim function dumping core
- Previous by thread: Re: malloc
- Next by thread: Re: malloc
- Index(es):
Relevant Pages
|
|