Solved

max memory capacity of turbo C small model

Posted on 2003-12-06
6
401 Views
Last Modified: 2010-04-17
 hello
     I wrote a code in Turbo C involving complex numbers upto [17][256] 2d-array.    When I run this program, I receive "Abnormal Termination" and application performed Illegal operation. I want to know what is the max limit of usage of memory. If I want to exceed the limit, what should I do.

   Iam working on Turbo C,windows 98,128RAM(32 shared)

Thanking you
best regards
srikanth
0
Comment
Question by:cbodapati
  • 3
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
cookre earned 25 total points
ID: 9891358
Small model limit is 64K, plenty that array.  If you need more, move up to large model and use MAPIAllocateBuffer.  Note that alloc() is limited to 64K per call.

Illegal operation means execution got to a bad instruction.  A likely candidate for this an index that went beyond the bounds of an array, wiping out code.  This is usually requires some effort to do - except in the small model where both data and code are in the same segment.
0
 
LVL 1

Expert Comment

by:th83
ID: 9891871
You can use "far pointer" to allocate more memory then 64k.
0
 
LVL 22

Expert Comment

by:cookre
ID: 9892144
Huh?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Expert Comment

by:th83
ID: 9892456
void far *farcalloc(unsigned long nunits, unsigned long unitsz);

farcalloc allocates memory from the far heap for an array containing nunits elements, each unitsz bytes long.

NOTE: For allocating from the far heap:
■ all available RAM can be allocated.                                      
■ blocks larger than 64K can be allocated.                                  ■ far pointers (or huge pointers if blocks                                
are larger than 64K) are used to access the allocated blocks.

char far *fptr;                                                          
 /* allocate memory for the far pointer */                                
fptr = (char far *) farcalloc(10, sizeof(char));


It has been years since i left console programming in  Turbo C. That is the reason i haave copied the above form Troubo C help.

Look at the  Turbo C Help for more information.



TH  


0
 
LVL 22

Expert Comment

by:cookre
ID: 9892488
Whew, a typo.  I was just a tad skeptical about using a type declaration to get memory.
I live mainly in the MS world where there is no farcalloc().
0
 

Assisted Solution

by:minamkhan
minamkhan earned 25 total points
ID: 9892923
small model limit is 64k and i tthink that it is too much for that array. Actually there will be a problem with ur code maybe problem with the declaration or with the index out of bound problem but if u wanna switch to large model in TC if u r using TC-300 or TC-3 compiler than click "options" than click "compiler" than click "Advanced code generation" and  a dialog box will be displayed in front of u than choose 80286 in "Instruction set"  and in the editbox there will be written "32767" erase it and write "65535"  also check farcheckptr in options.
now u can use far ptr or near ptr to allocate memory because ur program is now in large model
I hope that it will solve ur problem
Regards
minamkhan  
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 60
countPairs challenge 7 58
base64 decode encode 12 100
Modify a small python script 19 56
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now