Re: sizeof([ALLOCATED MEMORY])



ballpointpenthief said:

If I have malloc()'ed a pointer and want to read from it as if it were
an array, I need to know that I won't be reading past the last index.

When you allocate the memory, you know precisely how much memory you are
requesting.

Don't Forget (tm).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.



Relevant Pages

  • Re: Another C# marshaling question
    ... // Get the pointer of the location in memory. ... > public static extern int FF_Function( ... > // Allocate the array. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: INTENT(WORKSPACE) as a new Fortran feature?
    ... >> the array once in the caller than each time within the subroutine. ... > the stack pointer is being changed to allocate local variables in any ... "actual" memory would never be touched at all. ... If, on a particular machine, the compiler knows that it would be ...
    (comp.lang.fortran)
  • Re: Storing the size of an array in the structure itself
    ... >> I think every C programmer can relate to the frustrations that malloc ... >> the size of an array must be stored separately to be a nightmare. ... is anything more than just that - a chunk of memory. ... > Otherwise you couldn't tell it how much to allocate. ...
    (comp.lang.c)
  • Re: Creating a logical matrix in a mex-file
    ... Then use mxMalloc to allocate the memory ... Use mxSetData to set the data of the array to the ... This would avoid the initialization of the memory. ...
    (comp.soft-sys.matlab)
  • Re: The problems arrayed before me...
    ... > When an array is grown, how does Delphi manage this cleanly? ... default memory manager, the first thing it tries to do, when it receives ... When you ask for a certain amount of memory, the memory manager is free ... to allocate more than you ask for, and it keeps track of that. ...
    (alt.comp.lang.borland-delphi)