Thread: Memory problem with Borland C 3.1

  1. #16
    Registered User
    Join Date
    Sep 2006
    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:
    #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 ");
       printf("Block of 80,000 bytes allocated at &#37;Fp\n", bigblock);
       printf("\n\n Press Enter");
       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.

  2. #17
    Registered User
    Join Date
    Nov 2007
    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!

Popular pages Recent additions subscribe to a feed

Similar Threads

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