I've downloaded R and found the actual error you're getting. It's in r-source/src/main/memory.c:
R_BCNodeStackBase = (R_bcstack_t *) malloc(R_BCNODESTACKSIZE * sizeof(R_bcstack_t)); if (R_BCNodeStackBase == NULL) R_Suicide("couldn't allocate node stack");
So certainly it's a memory error - a failed call to malloc.
I tried making a simple R test question using exactly your prototype and of course it worked fine for me :) Here's the proof:
I attach the exported Moodle XML question; please try importing and running that first off. If that works on your system too, then the problem is in the setting of the memory limit. But I suspect it will fail on your system too. In which case: tell me a bit about your Jobe server. What version of Linux is it running on? Were any non-standard actions taken during the install?
Richard