PgrAm
Experienced Member
So I working on a game for real mode DOS right now in C++ using WATCOM. I appear to be having trouble running out of memory long before I think I should. I allocate all memory using the c++ "new" operator as needed, which I assume uses int 21h, ah = 48. This limits me to the first 640k of memory as far as I know with a granularity of 16 bytes. I used QEMM and DOS tells me I have 655360 bytes available.
There's a few things I can do to reduce my memory usage but I'm fairly sure that my issue is a problem of fragmentation, in order to improve this it would help to understand how dos allocates memory but i cant find much info on this. Does DOS just return the first free block? Does it try to avoid fragmentation somehow? Does it do any paging? how does it know to avoid TSRs? how can I access the more than 640k without using protected mode (eg. with a 286) and how do I know if there is any?
Thanks.
There's a few things I can do to reduce my memory usage but I'm fairly sure that my issue is a problem of fragmentation, in order to improve this it would help to understand how dos allocates memory but i cant find much info on this. Does DOS just return the first free block? Does it try to avoid fragmentation somehow? Does it do any paging? how does it know to avoid TSRs? how can I access the more than 640k without using protected mode (eg. with a 286) and how do I know if there is any?
Thanks.
Last edited: