[racket-dev] Memory consumption of Racket

From: Kevin Tew (tewk at cs.utah.edu)
Date: Fri Apr 22 08:06:00 EDT 2011

You might try this patch

diff --git a/src/racket/gc2/block_cache.c b/src/racket/gc2/block_cache.c
index dd522aa..c34c2df 100644
--- a/src/racket/gc2/block_cache.c
+++ b/src/racket/gc2/block_cache.c
@@ -7,7 +7,7 @@ static void  *os_alloc_pages(size_t len);
  static void   os_free_pages(void *p, size_t len);
  static void   os_protect_pages(void *p, size_t len, int writable);

-#define BC_BLOCK_SIZE (1 << 24)  /* 16 MB */
+#define BC_BLOCK_SIZE (1 << 21)  /* 2 MB */

  struct block_desc;
  static AllocCacheBlock *alloc_cache_create();


On 04/22/2011 05:08 AM, Robby Findler wrote:
> This program:
>
>    #lang racket/base
>    (printf "hi\n")
>
> uses a lot less memory than this one:
>
>    #lang racket
>    (printf "hi\n")
>
> Does that help at all?
>
> Robby
>
> On Fri, Apr 22, 2011 at 12:09 AM, Nevo<sakur.deagod at gmail.com>  wrote:
>> hi
>>    My attempt on porting Racket interpreter to iOS has been for a while and
>> I've been able to run interpreter on both iOS device as well iOS simulator.
>> Right now, it runs perfectly on iOS simulator, but lack of satisfaction on
>> device. The reason is for those devices like iPad/iPhone or Android, the
>> memory for standalone application is always constrained, and even a single
>> "hello world" evaluation would easily put the whole app runtime to death,
>> per my test. In particular, here I've got some commented out "printf" code
>> compiled in for newgc.c, and trying to load a simple "hello world" racket
>> file to evaluate results in more than 30MB memory in use (reported by gc).
>> This is nothing for a desktop, but will kill itself easily in iOS which
>> usually requires the average memory allocation will be less than 20MB. So
>> I'm asking if there's some known compiling or runtime configuration which I
>> may not know to reduce memory usage, at least keep average allocation
>> acceptable for those memory constrained devices. Thanks for your suggests
>> here!
>> Nevo
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://lists.racket-lang.org/listinfo/dev
>>
> _________________________________________________
>    For list-related administrative tasks:
>    http://lists.racket-lang.org/listinfo/dev



Posted on the dev mailing list.