deferpanic/gorump

gc doesnt work for gorump programs

yuval-k opened this issue · 7 comments

In this commit:
87eaedc

The heap size is supposed to be limited to 32MB. But in-fact 21 bits are only 2MB.

The go GC will run only when the heap reaches 4mb -> hence it wont run soon enough to clean up the heap.

Also note that the implementation of malloc.go relies heavily on virtual memory (which is not available in rumprun), and as a result code paths for 64bit and 32bit get mixed up.

I believe all these combined also caused #26

so a couple of things...

  1. antti could correct me on this but rumprun will never implement virtual memory since it doesn't make sense for it to have it in unikernel land - this is one of those incongruences go/unikernels have and we just have to work around it

  2. I'm fine w/bumping it to 22 or 23 bits to hit the 4mb mark, but that value affects other things which make the minimal amount of memory go up (eg: if I recall it wouldn't just be adding 4/8 extra mb) - before committing a change to a higher value I'd be interested in knowing what the min. size would be after that - I think right now it's 32M

as for 1) that's correct go heap model is optimized for OSes that support virtual memory (specifically, they use the ability to reserve memory addresses with out allocating them) and should probably be heavily modified for rumprun.

as for 2) not sure what you are asking. What I don't understand is why the comment message says 32MB while 21 bits of heap is only 2MB (which is really low for most applications i believe).

you're running into this issue -- #14

it's confusing - you're right 2**21 is only 2097152 and I could be wrong, but as I recall _MHeapMap_TotalBits doesn't define the actual total memory used, iirc there were other constants defined elsewhere - but maybe I'm completely wrong on that

for instance does bumping this up to 24 bits (16M) still work under qemu w/32M?

when i bumped it to 25 (32M) it did not work with 128M but did work with 256M qemu.

yeh -- I don't remember where the other dependent constants are but this is why that comment said 32M - maybe @anttikantee remembers? - as for now to let GC do it's thing - does 23 bits work under 32M?

I scraped my test environment so it's hard for me to do more tests now... :/
I do think the long term plan should be to change the way the heap works entirely.

for sure - I'll try to schedule some time to dive in