Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: David Kuehling Newsgroups: comp.lang.forth Subject: Re: Maximum heap memory available to GForth when allot-ing? Date: Tue, 01 Apr 2014 06:34:54 +0200 Lines: 41 Message-ID: <87mwg5d5w1.fsf@snail.Pool> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de /jj/hVSOzMQXsHRMTr71lQtN77eFzlEjzMNPd6dZsSVp+HDn0= Cancel-Lock: sha1:o8jNE+VlccplVNE2I+MpEQMhdlg= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Xref: csiph.com comp.lang.forth:29207 >>>>> "Assad" == Assad Ebrahim writes: > But I am wondering why I even have to adjust the dictionary size at > all. > I would have thought that using allot would put a request to the OS to > return free memory, which could be from RAM or from Virtual Memory. > And given that my computer has 2GB RAM and in excess of 10GB free disk > space available to Virtual Memory, I was expecting that I could allot > much more than 500k cells without needing to adjust the dictionary > space. > What am I missing? The region accessed via ALLOT is guaranteed to be contiguous (the ANS standard defines it that way) and behaves like a large stack (that is growing towards higher addresses). I.e. you can repeatedly call ALLOT to increase memory of one arrays, for example, and free memory allocated with ALLOT by just running ALLOT on the negative number of bytes previously ALLOTed. If you don't need the guarantee of contiguity, use ALLOCATE [1]. This directly requests memory from the OS and won't depend on the "-m" command line switch. You free the memory allocated via ALLOCATE with FREE. > Does the command create w N cells allot actually reserve N cells in > the dictionary? Yes it does. cheers, David [1] http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Heap-Allocation.html#index-allocate-_0040var_007b-u-_002d_002d-a_002daddr-wior--_007d--memory-823 -- GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk2.gpg Fingerprint: B63B 6AF2 4EEB F033 46F7 7F1D 935E 6F08 E457 205F