473,466 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Allocating large memories

14 New Member
I need to allocate memory of a few 100's of KB, using DOS on an Intel x86 processor. There is a way around using TurboC compiler specific features(messy). But can it be done with ANSI C?
(The problem arises with Intel's segmented memory and DOS's incapability of handling 32-bit addresses)
I've found very little resources on the internet regarding these topics. Will be glad if you could point to one.
Jul 15 '07 #1
3 1420
JosAH
11,448 Recognized Expert MVP
I need to allocate memory of a few 100's of KB, using DOS on an Intel x86 processor. There is a way around using TurboC compiler specific features(messy). But can it be done with ANSI C?
(The problem arises with Intel's segmented memory and DOS's incapability of handling 32-bit addresses)
I've found very little resources on the internet regarding these topics. Will be glad if you could point to one.
If I remember well those DOS C compilers had flags for that purpose: 'large
memory model' used segment:offset pointers for both code addresses as well
as data addresses. Check your compiler's flags.

kind regards,

Jos
Jul 15 '07 #2
manu1001
14 New Member
Yes, I've seen that, but it requires the usage of far pointers which is not part of the standard C. It would probably require a lot of modification to port it elsewhere.
Isn't there an alternative?
Jul 15 '07 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
The data segment has a limit and you have to use near/far pointers plus compile for the memory model (TINY, LARGE, HUGE, etc... If I remember, DOS does all the swapping using a disc swapfile. Your task is to keep things within a segment to avoid a swap.

Unfortunately, it has been 12 years since I used DOS and I hace discarded all of my reference books and DOS software.

None of this has anything to do with C. These are just limits imposed on you by DOS.
Jul 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Jakob Bieling | last post by:
Hi, Whenever allocating memory using operator new or operator new I feel like I should only use it very sparingly, because otherwise memory is wasted (by additional overhead needed to manage all...
22
by: ranjeet.gupta | last post by:
Dear All. As far as i know that Then memeory is divided into the three segements 1. Heap; 2. Stack; 3. Data segmnet; But I am not getting the exact picture of the diffrence and the...
5
by: David | last post by:
Hi all: I am processing a 3D bitmaps(essentially ~1024 2D bitmaps with a size of 1MB each). If I want read large amount of radom data from this series, how could I buffer the file to get...
6
by: Rajorshi Biswas | last post by:
Hi folks, Suppose I have a large (1 GB) text file which I want to read in reverse. The number of characters I want to read at a time is insignificant. I'm confused as to how best to do it. Upon...
3
by: Tod Birdsall | last post by:
Hi All, The organization I am working for has created a new corporate website that used Microsoft's Pet Shop website as their coding model, and dynamically served up content, but cached each...
19
by: allanallansson | last post by:
Hi i would like some guidelines for a experiment of mine. I want to experiment with the swap and ctrl-z in linux. And for this i want to create a c program that allocates almost all the free memory...
8
by: Francine.Neary | last post by:
I'm experimenting with a program that manipulates a large matrix, i.e. a 2-deep array. I started by just allocating this in one go, but later it occurred to me that, as there are still some very...
3
by: Kane | last post by:
When you create node 1 you allocate memory and link it Again when you create node 2 you would allocate memory for that node in a different section of the code. Is there more efficient way where I...
6
by: arashmath | last post by:
Hi everyone, I have a problem with large dynamic memory allocating. this is my code (in briefness): #include <stdio.h> #include <mem.h> #include <assert.h> #define SML_BOUNDS_CHECK
13
by: charlie | last post by:
I came up with this idiom for cases where a function needs a variable amount of memory for it's temporary storage so as to avoid constantly mallocing. It makes me feel a little uncomfortable to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.