Solved

max memory capacity of turbo C small model

Posted on 2003-12-06
6
402 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

773 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