C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-16-2007, 03:38 AM   #16
Registered User
 
Join Date: Sep 2006
Posts: 3,150
In Turbo C and C++, the size of a single object can exceed 64K, according to the reference book "The Waite Group's Turbo C++ Bible", by Barkakati.

You can do that by using a memory model that supports it, if (and only if), you have enough physical (or virtual memory given to the program, from an OS like Windows).

The book mentioned has examples of all the Turbo C/C++ key words, in versions 1.0, 1.5, and 2.0.

From what I've just read, it basically makes 2 or more memory blocks, appear like one large memory block, to the programmer.

I heartily recommend grabbing a copy of this book, if you can find it. It's a treasure trove of everything in early Turbo C/C++, with examples for darn near every single thing.

This is the Turbo C/C++ Bible's example for allocating 80,000 bytes:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <alloc.h>

int main()
{
   int far *bigblock;
   if ((bigblock = farmalloc(80000L)) == NULL)
   {
      printf("Memory allocation failed!\n");
      printf("\n\n Press Enter ");
      getchar();
      exit(1);
   }
   printf("Block of 80,000 bytes allocated at %Fp\n", bigblock);
   printf("\n\n Press Enter");
   getchar();  

   return 0;
}
This program will not run in the Tiny memory model. If successful, it returns a far pointer to the allocated block of memory. If not, it returns NULL.

I played with this for awhile with WindowsXP using the IDE. I couldn't get it to work, but I'm not experienced with messing with all the compiler options, command line interface for it, and etc.

Last edited by Adak; 11-16-2007 at 09:52 AM.
Adak is offline   Reply With Quote
Old 11-16-2007, 11:22 AM   #17
Registered User
 
Join Date: Nov 2007
Posts: 8
I found what was the problem...

My fuction and all my part of cade was called by an interrupt fuction. And this was the problem, becouse in the old machine and especially with my old compiler is very dangerous to call a fuction (a big fuction like mine) with lots of memory allocated and with lots of matematics operation.. But was not easy to found that my code was called by an interrupt fuction!
AZ1699 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with atl memory cleaning Mariam1989 Windows Programming 1 11-11-2008 12:35 PM
To find the memory leaks without using any tools asadullah C Programming 2 05-12-2008 07:54 AM
Memory problem...? Xzyx987X Windows Programming 4 06-30-2004 05:02 PM
Is it necessary to write a specific memory manager ? Morglum Game Programming 18 07-01-2002 01:41 PM
Program abort due to memory problem cazil C++ Programming 5 01-21-2002 12:55 PM


All times are GMT -6. The time now is 08:03 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22