Solved

max memory capacity of turbo C small model

Posted on 2003-12-06
6
404 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL:  Sigh---Boy, this is fun.... 12 67
programming a polycom voip phone 3 52
BATCH to EXE Converter 2 67
Crashing when deleting value with no child in Binary Tree 4 24
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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 …

713 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