Solved

Allocating memory above 1MB in DOS

Posted on 1998-09-14
4
262 Views
Last Modified: 2008-02-01
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?
0
Comment
Question by:mejia
  • 2
4 Comments
 
LVL 16

Expert Comment

by:imladris
ID: 1252713
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.

0
 
LVL 2

Accepted Solution

by:
warmcat earned 100 total points
ID: 1252714
Mejia-darling,

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.

Regards,

-Andy
0
 

Author Comment

by:mejia
ID: 1252715
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. " ?

Thanks
0
 
LVL 2

Expert Comment

by:warmcat
ID: 1252716
mejia,

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.

-Andy
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ vs C compilers 13 160
C, Typedef struct, how to define const sub-variable within union/struct, is there a way to do this? 12 157
how to understand recursion 12 230
delete-remove 14 97
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question