Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Allocating memory above 1MB in DOS

I am trying to read two matrixes with 600 times 600 integer elements each one and to subtract them in a C program running under DOS in a computer with 16MB RAM. Is it possible to have the three arrays in RAM simultaneously, running under DOS?
  • 2
1 Solution
There is no straightforward way of allocating the roughly 720K that would be needed for 3 600 by 600 matrices of integers (2 bytes I assume).

Given your mention of reading, I'm assuming that the two matricies to be subtracted are in fact in files on disk. Doing the subtraction one row at a time, or maybe 10 rows at a time, should not lead to a noticably slower solution.


There is the old EMS(?) Extende memory manager thing that works through EMM386 via an INT-based API.

Also, using HUGE * will allow you to access them in a reasonably civilized way.  But for this kind of job, 32-bit is your man.  The now slightly stinky Watcom compiler, available cheaply, includes a Dos Extender and allows you to write 32 bit flat code with plain old DOS.  With that, you can literally go:

  int iaOne[300][300], iaTwo[300][300], iaThree[300][300];

and think nothing of it.


mejiaAuthor Commented:
To warmcat:

Could you be more specific about: "There is the old EMS(?) Extende memory manager thing that works through EMM386 via an INT-based API. " ?


Unfortunately this has been deemed by MS as too old to bother with, and is on neither their MSDN website nor my copy of the full MSDN.  However, hit your local bookstore and you're bound to find something in the remainder bin.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now