Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #29207

Re: Maximum heap memory available to GForth when allot-ing?

From David Kuehling <dvdkhlng@posteo.de>
Newsgroups comp.lang.forth
Subject Re: Maximum heap memory available to GForth when allot-ing?
Date 2014-04-01 06:34 +0200
Message-ID <87mwg5d5w1.fsf@snail.Pool> (permalink)
References <furjj9pimcjmh79a1t8j49dqfcl6aroiat@4ax.com>

Show all headers | View raw


>>>>> "Assad" == Assad Ebrahim <assad.ebrahim@alum.swarthmore.edu> 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

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assad.ebrahim@alum.swarthmore.edu> - 2014-04-01 00:10 +0100
  Re: Maximum heap memory available to GForth when allot-ing? David Kuehling <dvdkhlng@posteo.de> - 2014-04-01 06:34 +0200
    Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-04-01 00:19 -0700
  Re: Maximum heap memory available to GForth when allot-ing? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-04-01 15:53 +0000
    Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-04-01 13:12 -0700
      Re: Maximum heap memory available to GForth when allot-ing? Bernd Paysan <bernd.paysan@gmx.de> - 2014-04-01 23:06 +0200
        Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-04-01 14:42 -0700
        Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-04-01 18:04 -0700
          Re: Maximum heap memory available to GForth when allot-ing? David Kuehling <dvdkhlng@posteo.de> - 2014-04-02 09:41 +0200
            Re: Maximum heap memory available to GForth when allot-ing? Bernd Paysan <bernd.paysan@gmx.de> - 2014-04-02 12:27 +0200
              Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-04-02 10:35 -0700
                Re: Maximum heap memory available to GForth when allot-ing? Bernd Paysan <bernd.paysan@gmx.de> - 2014-04-02 20:49 +0200
                Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-04-02 16:44 -0700
                Re: Maximum heap memory available to GForth when allot-ing? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-03 05:12 -0500
                Re: Maximum heap memory available to GForth when allot-ing? Mark Wills <markwills1970@gmail.com> - 2014-04-03 04:14 -0700
                Re: Maximum heap memory available to GForth when allot-ing? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-03 08:26 -0500
                Re: Maximum heap memory available to GForth when allot-ing? Bernd Paysan <bernd.paysan@gmx.de> - 2014-04-03 23:04 +0200
                Re: Maximum heap memory available to GForth when allot-ing? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-04 02:36 -0400
                Re: Maximum heap memory available to GForth when allot-ing? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-04 03:38 -0500
                Re: Maximum heap memory available to GForth when allot-ing? Bernd Paysan <bernd.paysan@gmx.de> - 2014-04-04 15:19 +0200
                Re: Maximum heap memory available to GForth when allot-ing? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-04 18:03 -0400
                Re: Maximum heap memory available to GForth when allot-ing? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-05 09:12 -0500
                Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assad.ebrahim@alum.swarthmore.edu> - 2014-04-05 15:37 +0100
                Re: Maximum heap memory available to GForth when allot-ing? hughaguilar96@yahoo.com - 2014-04-07 23:25 -0700
                Re: Maximum heap memory available to GForth when allot-ing? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-08 06:13 -0400
                Re: Maximum heap memory available to GForth when allot-ing? Assad Ebrahim <assad.ebrahim@alum.swarthmore.edu> - 2014-04-03 12:39 +0100
                Re: Maximum heap memory available to GForth when allot-ing? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-03 08:33 -0500
                Re: Maximum heap memory available to GForth when allot-ing? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-04-03 10:47 +0000
  Re: Maximum heap memory available to GForth when allot-ing? hughaguilar96@yahoo.com - 2014-04-01 16:36 -0700

csiph-web