Re: Are array members guaranteed to be contiguous in physical memory?

From: Goran Larsson (hoh_at_invalid.invalid)
Date: 11/29/04


Date: Mon, 29 Nov 2004 16:00:32 GMT

In article <41ab3e32.438548648@news.individual.net>,
Richard Bos <rlb@hoekstra-uitgeverij.nl> wrote:

> > I just wonder if array members guaranteed to be contiguous in
> > physical memory
>
> Yes. The Standard demands it.

Chapter and verse, please.

In 6.2.5 clause 20 the Standard guarantees that the array is
contiguously allocated, but the memory is the memory of the abstract
machine described in 5.1.2.3, not the physical memory of the hosting
environment.

> Probably because the ISO C Committee thought (rightly, IMO), that the
> opposite would be a major pain in the backside.

Demanding that array members be contiguous in physical memory must be a
terrible burden on the compiler runtime environment as it has to have
knowledge about how to request contiguous physical memory from the
execution environment. I have never seen this done for ordinary array
members.

-- 
Göran Larsson     http://www.mitt-eget.com/


Relevant Pages

  • Re: Fortran Features
    ... That would just fall into the category of allowed optimizations. ... The standard does not and has never specified details such ... requiring no physical memory or time. ...
    (comp.lang.fortran)
  • Re: Swap File needed for PC with 512 MB?
    ... A swap file approximately 2 times the amount of physical memory is fairly ... standard. ... I have a full GB of physical memory, and still have a swap file. ...
    (microsoft.public.windowsxp.general)
  • Re: 3 questions about arrays
    ... In order to print the elements of the array doesn't the ... If yes then it's undefined behavior. ... choosing the size of fixnums not the maximum size of arrays. ... That's already the case in plenty of CL implementations -- unless a lot of people have 60 bits of physical memory they're not telling anyone about. ...
    (comp.lang.lisp)
  • Re: WMI crashing incessantly.
    ... I have the same opinion with our engineer Gabriel GHIZILA who ... How many of your machine's available physical memory ... just the environment in general (exactly what has ... suffering from lack of memory or heap fragmentation. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Maximum Array int is 330 M, not 2.1 billion
    ... I simply filled an array of this size with ints...I got as far as 320 ... What is relevant is the address space limit of your application, which happens to be 2 GiB on 32-bit Windows, which happens to be the maximum value of a signed 32-bit int as well -- but this is coincidental. ... You can make Windows run with a 3 GiB virtual address space for each application, for example, and 64-bit applications have a unfathomably bigger limit that I can't recall right now, but you'll hit the limits of your physical memory far sooner than that. ... There is no extra per-element overhead for managed arrays. ...
    (microsoft.public.dotnet.languages.csharp)