Re: sizeof([ALLOCATED MEMORY])
- From: "Nils O. Selåsdal" <noselasd@xxxxxxxxxxxxxxxxxxxxx>
- Date: 4 May 2006 02:41:51 +0200
Howard Hinnant wrote:
In article <eJ6dnTe9u7iOZMrZnZ2dnUVZ8sydnZ2d@xxxxxx>,Why would they make use of more memory than they requested instead of
Richard Heathfield <invalid@xxxxxxxxxxxxxxx> wrote:
ballpointpenthief said:
If I have malloc()'ed a pointer and want to read from it as if it wereWhen you allocate the memory, you know precisely how much memory you are requesting.
an array, I need to know that I won't be reading past the last index.
Don't Forget (tm).
However when you allocate the memory, you don't know precisely how much you received. It could be more than you requested. And common applications exist which could make use of that extra memory if only they knew it existed (e.g. a dynamic array).
just requesting that much memory in the first place ?
Major OS's provide this functionality in a non-portable fashion. Imho C should provide a portable layer over this functionality.No.
How horrible.
.
- Follow-Ups:
- Re: sizeof([ALLOCATED MEMORY])
- From: Howard Hinnant
- Re: sizeof([ALLOCATED MEMORY])
- References:
- sizeof([ALLOCATED MEMORY])
- From: ballpointpenthief
- Re: sizeof([ALLOCATED MEMORY])
- From: Richard Heathfield
- Re: sizeof([ALLOCATED MEMORY])
- From: Howard Hinnant
- sizeof([ALLOCATED MEMORY])
- Prev by Date: Re: printf headache
- Next by Date: Re: Checking whether an array contains a majority elemnt....
- Previous by thread: Re: sizeof([ALLOCATED MEMORY])
- Next by thread: Re: sizeof([ALLOCATED MEMORY])
- Index(es):
Relevant Pages
|