标签云

微信群

扫码加入我们

WeChat QR Code


meagar This does raise some questions not mentioned in the question you linked to.

2018年10月23日57分32秒

"Stack memory almost always must be manually freed." You meant heap memory. Also, it's worth mentioning that heap memory is "global", when you run out of heap other applications will also run out of heap. The stack though, has local scope.

2018年10月23日57分32秒

This is wrong in so many ways. There is typically no difference at all between "stack memory" and "heap memory", on any architecture I'm aware of. Both can be accessed by stack pointer, index registers, or whatever. Both the stack pointer and index registers can be changed arbitrarily to access any memory available to the process.

2018年10月23日57分32秒

unapersson: The RAM is the RAM, and the SP can be change and assigned of course. "Stack Memory" is more a term of intent or role - not necessarily of a specialize piece of hardware. BTW, in the case of the 6502, your stack was indeed stuck at Page 1 (bytes 256 thru 511).

2018年10月23日57分32秒

rskar Yes indeed. I wrote an implementation of the KERMIT protocol, with full VT100 terminal emulation on the BBC Micro in 6502 assembler (not a happy experience for a Z80 programmer) back in 1984, so I do know of what I speak here.

2018年10月23日57分32秒

rskar For most architectures, there is no difference between stack memory and ordinary memory. Even on the 6502 you could (and sometimes had to) implement your own stack in "ordinary" memory - you just could not use it via call and return opcodes. Even on the 6502 there was nothing special about stack memory, only about how it was accessed (via the 6502 stack page) You seem to be suggesting that there is actually a physical difference between stack and other types of memory.

2018年10月23日57分32秒

unapersson: My apologies - I never meant to suggest that there is actually a physical difference between stack and other types of memory.

2018年10月23日57分32秒

"Make a system backup" before trying to fill the heap? What platform are you on, MS-DOS?

2018年10月23日57分32秒

larsman No, I've had this crap out expensively on Unix systems where user limits were not set. And it will probably cause problems even on "modern" operating systems - try it (with my proviso).

2018年10月23日57分32秒

unapersson: I've run out of memory on Unix and Linux systems before. I never experienced any great problems; usually just a long slow-down until everything was back in order, sometimes the necessity to reboot.

2018年10月23日57分32秒

larsman But did you remove the limits on user processes? And have you tried it on, say, Windows? And most for most of us Unix folks, the "necessity to reboot" is the next step to getting the sack.

2018年10月23日57分32秒

unapersson: all systems (Linux, Mac OS X, OpenBSD) had default limits. And no, I never try anything heavy on Windows, I hate cleaning up broken glass ;)

2018年10月23日57分32秒