Wrong size of memory pools – dumb

Occasionally I had a look at /dev/memory:

What I saw there?

; cat /dev/memory
    2282656    14018478     2314496       14149        6246          18    11735810 main
     492768     7009239      499488      110133      106946           4     6516459 heap
       4960    14018478        4960           8           1           1    14013506 image
;

What? I run my Inferno just on 14+7+14 = 33MB memory? (yep and it still runs ok ;) )

The code that define size of memory pools was just copied from other ports:

	ulong nb;
	ulong mpb,hpb,ipb;

	nb = conf.npage*BY2PG;
	mpb = (nb*main_pool_pcnt)/100;
	hpb = (nb*heap_pool_pcnt)/100;
	ipb = (nb*image_pool_pcnt)/100;

	poolsize(mainmem, mpb, 0);
	poolsize(heapmem, hpb, 0);
	poolsize(imagmem, ipb, 0);

See something dumb? :)

240MB memory is not safe to use in calculations because ulong cab be easily overflow to 4GB :)
Yep – 240MB * 50 (%) = 12 000 000 000.

Oops, all previous releases of inferno-rpi have only 33MB RAM. SORRY :)

Surely fixed and coming in next release soon…

Now it is right:

; cat /dev/memory
    2400480    99917824     2434464       14596        6408          18    97517332 main
     498688    49958912      500576      110906      107649           4    49460212 heap
       4960    99917824        4960           8           1           1    99912852 image
; 
This entry was posted in Blog, Inferno OS, Misc, Raspberry Pi, Research. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Clef two-factor authentication