farrealloc() bug in Turbo C

Clifton Bean clifton at egsner.cirr.com
Fri May 4 10:34:55 AEST 1990


In article <6377 at vax1.acs.udel.EDU> ray at vax1.acs.udel.EDU (Thomas Ray) writes:
>
>     The function farrealloc() in Turbo C is described as ``Adjusts allocated
>block in far heap....  Blocks larger than 64K can be allocated''.  The
>problem is that it only works for blocks of up to 64K.  I called their
>technical support, and they were not aware of the problem, but upon
>examining the source code, said that in fact it would not work for blocks
>larger than 64K because it first allocates another block with farmalloc(),
>and then uses memmove() to move the data from the old block.  However,
>memmove() only handles up to 64K and they forgot to code in the case of more
>than 64K.  Stupid!
>
>    The technician suggested that I write my own farrealloc() using
>farmalloc() and memmove().  It sounded good at the time, but later I realized
>that I would need to know how big the old block was in order to move it
>properly (when going to a larger block).  Since that information is not
>passed to the function, it must be gotten from the system and I don't know
>how to do it.  There is currently a discussion on this problem in comp.lang.c
>under the subject heading of malloc/free.  I called back to the technical
>support to discuss the matter further, but the guy I got was very rude and
>told me he didn't have time to look into it.
>
>     So, does anyone have a piece of code that can do a farrealloc() in
>Turbo C, or can anyone write and test such a function?  It would be nice
>to have a farrealloc() that would try to expand the block before resorting to
>the malloc()/memmove() combination.  This will be especially critical for
>large blocks because there will very likely not be enough room to make another
>block before discarding the old one.  If you send me a fix by email, I will
>summarize and post the responses.
>
>                             Tom Ray
>                       University of Delaware
>                  School of Life & Health Sciences
>                      Newark, Delaware  19716
>                         ray at vax1.udel.edu
>                           302-451-2753

I have seen mail from quite a few people at Informix posted here, and since
I use Informix-Turbo and I am thinking about upgrading to Online, I thought
I would post this article from comp.lang.c and see what the good people
could do for us.
-- 
*******************************************************************************
Clifton M. Bean                          USENET: clifton at lodestar.lonestar.org
Page & Addison, P.C., Dallas, TX           UUCP: ...!egsner!lodestar!clifton
Work Phone: (214) 960-0933 (9-6 CDT)         OR: ...!texbell!lodestar!clifton



More information about the Comp.lang.c mailing list