Javascript engines increasingly resemble normal program for memory layout:
A binary program has [static memory][stack memory][heap memory] in that order.
[static memory] has a fixed length and contains just global (usually constant) values.
[stack memory] is fixed length, but not all of it is used. The call stack starts at the top and grows down. If you run out of space then you get a stack overflow.
[heap memory] is dynamically allocated. If you run out of heap memory then your program requests to extend the memory boundary from the operating system, if this is denied then you OOM somehow.
Sorry if it sounded condescending. It's just that I had a teacher who observed that her C++ students were immediately very confident with programming, but "higher level" languages made beginner students really unsure about how things worked.
Drawing back the curtain is sometimes a great way to teach.
Javascript engines increasingly resemble normal program for memory layout:
A binary program has [static memory][stack memory][heap memory] in that order.
[static memory] has a fixed length and contains just global (usually constant) values.
[stack memory] is fixed length, but not all of it is used. The call stack starts at the top and grows down. If you run out of space then you get a stack overflow.
[heap memory] is dynamically allocated. If you run out of heap memory then your program requests to extend the memory boundary from the operating system, if this is denied then you OOM somehow.
yes! I know something about OOM :-)
Sorry if it sounded condescending. It's just that I had a teacher who observed that her C++ students were immediately very confident with programming, but "higher level" languages made beginner students really unsure about how things worked.
Drawing back the curtain is sometimes a great way to teach.
Oh it was not! I appreciate your comment. Cheers!