[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variables in yyparse

From: Paul Hilfinger
Subject: Re: variables in yyparse
Date: Sun, 19 Dec 2004 14:44:06 -0800

> According to my understanding, virtual memory and paging allow a process to
> have an address space much larger than the actual main memory available to
> that process.  However, dynamic memory allocation takes place on the heap,
> which is of fixed size.  So these are "two different pairs of shoes", as we
> say in German.

The heap is of "fixed size", but on many systems, this fixed size can
be the size of virtual memory.  

> I think this code:
> for (;;)
>    new int;
> will eventually cause a `bad_alloc' to be thrown, but will not cause pages to
> be written to files.  No C++ on this machine, so I can't test it.

Not quite. The memory allocator typically keeps administrative
information next to the allocated storage, requiring it to "dirty" the
VM pages allocated to it, so this loop WILL generally write pages to disk.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]