Timeline for Do you need to allocate memory before you use it in MS-DOS?
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 18, 2021 at 8:57 | history | edited | Stephen Kitt | CC BY-SA 4.0 |
Link to Jerome Shidel’s RBIL conversion instead of DJ’s.
|
Oct 19, 2017 at 0:12 | comment | added | Jules | Note that there are many situations in which an application may not receive an allocation for all available memory, even if it requests it in its EXE file header, e.g. if you're running under a multitasker such as DesqView, the multitasker will generally allocate a smaller amount than requested (this is often by using an allocation size specified in a PIF file rather than the EXE itself). | |
Oct 18, 2017 at 9:28 | comment | added | el.pescado - нет войне | I think it would be good to clarify what "pre-allocating" means in context of single-task OS without memory protection, in which running process has access to whole computer memory. | |
Oct 17, 2017 at 19:20 | comment | added | user722 | MS-DOS 1.x didn't have the memory allocation functions and COMMAND.COM's separate resident and transient parts date back to its original implementation. Even after the allocation functions were added to MS-DOS 2 there was no way to allocate "discardable" memory that the OS could automatically free if something else needed it. | |
Oct 17, 2017 at 17:26 | comment | added | Raffzahn | IIRC spliting the command processor in two wasn't invented by DOS. And condidering the small RAM size of the first PC, I would have used the same strategy. | |
Oct 17, 2017 at 15:43 | comment | added | Stephen Kitt | Yes, indeed; memory allocation is perhaps one of the few areas where it’s straightforward ;-). (Unsurprisingly, DOS itself is not a good citizen, since COMMAND.COM uses unallocated memory, or should I say leaves part of itself resident without allocating a memory block as an interesting optimisation.) | |
Oct 17, 2017 at 15:38 | comment | added | Raffzahn | Beeing a good citizen isn't always easy under DOS - especially since there are so many little quirks that have been made to accomodate the less than perfect ones :) | |
Oct 17, 2017 at 15:10 | comment | added | Stephen Kitt | Indeed, it can ;-). I’ve updated my answer to merge your comments, thanks. | |
Oct 17, 2017 at 15:09 | history | edited | Stephen Kitt | CC BY-SA 3.0 |
Merge Raffzahn’s comments.
|
Oct 17, 2017 at 15:03 | comment | added | Raffzahn | Your answer is great and correct (I upvoted it). Thats why I didn't address you, but added to your answer. I belive the correct answer is 'no', as his question was if memory has to be allocated (explicit by his program) before using it, which is not neccesarry, as it's already allocated before any operation of his program gets executed. I guess it can be a different view if this implicit allocation is something one 'has to do' or something that 'has been done already'. Can't it? (P.S.: got the same book right on my desk :)) | |
Oct 17, 2017 at 14:35 | comment | added | Stephen Kitt | @Raffzahn that doesn’t contradict what I wrote: the header specifies the maximum amount needed, and DOS allocates at most that. This behaviour was documented early on (I had checked the MS-DOS Encyclopedia before writing my answer). I wrote “yes” in the first line because the memory is being allocated before being used. | |
Oct 17, 2017 at 14:28 | comment | added | Raffzahn | Little clarification: EXE Programms also did get all memory (i.e the largest block available) assigned at startup, as in ye olde days(tm) (that is al least until about DOS 4 times) the maximum extra paragraph value was by default set to FFFFh, thus asking for the biggest chunk available. So rather 'no', no meory request needed, but reasonable management of anything available after the last assigned symbol until the size of the block. | |
Oct 17, 2017 at 14:14 | history | edited | Stephen Kitt | CC BY-SA 3.0 |
The distinction is sub-functions, the age is irrelevant.
|
Oct 17, 2017 at 14:04 | history | answered | Stephen Kitt | CC BY-SA 3.0 |