From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: creating database
Date: 09 May 2005 08:33:48 -0400
Date: 2005-05-09T08:33:48-04:00 [thread overview]
Message-ID: <wccr7ggh93n.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 9cKdnRAx8IfEZOPfRVn-pg@comcast.com
tmoran@acm.org writes:
> > > don't know how many records there'll be so it seems inefficient to
> > > declare an array of a particular size.
> >
> > Sensible thinking.
> > ...
> > Instead of allocating a fixed size array - which on unix systems isn't
> > quite as bad an idea as it sounds - you can allocate and reallocate
> A fixed array allocation may be the both the most efficient and the
> simplest on a virtual memory system. The parts you don't use don't
> occupy any physical space, just address space, and the OS's allocation
> of physical space may well be difficult to beat in efficiency.
But I believe that by default, on both Unix and Windows, the OS will
allocate backing store (i.e. space in the paging file).
That can be a problem for really huge arrays.
To avoid that on Unix, use mmap with the NORESERVE flag,
and map the file /dev/zero -- then you'll get allocate-on-write
pages of virtual address space.
On Windows, it's a bit more complicated: use VirtualAlloc to reserve
pages, and then when you actually want to use them, use VirtualAlloc
again to "commit" pages.
- Bob
next prev parent reply other threads:[~2005-05-09 12:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-08 17:02 creating database caellumx
2005-05-08 17:36 ` Ludovic Brenta
2005-05-08 18:17 ` Jacob Sparre Andersen
2005-05-09 2:51 ` Matthew Heaney
2005-05-08 18:24 ` Jacob Sparre Andersen
2005-05-09 5:47 ` tmoran
2005-05-09 12:33 ` Robert A Duff [this message]
2005-05-09 3:00 ` Matthew Heaney
2005-05-11 16:57 ` brian.b.mcguinness
2005-05-11 21:16 ` Georg Bauhaus
2005-05-12 0:37 ` Randy Brukardt
2005-05-12 2:41 ` Matthew Heaney
2005-05-11 10:43 ` news.snafu.de
2005-05-12 2:50 ` Matthew Heaney
2005-05-12 7:31 ` Michael Erdmann
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox