Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!att!cbnews!r4 From: r4@cbnews.ATT.COM (richard.r.grady..jr) Newsgroups: comp.lang.c Subject: Re: A "simple" realloc() question. Message-ID: <7501@cbnews.ATT.COM> Date: 15 Jun 89 18:24:50 GMT References: <1606@csm9a.UUCP> Reply-To: r4@cbnews.ATT.COM (richard.r.grady..jr) Organization: AT&T Bell Laboratories Lines: 18 In article <1606@csm9a.UUCP> ddale@csm9a.UUCP (Doug Dale) writes: > > When using realloc(), if it is necessary to move the >information to another location in memory because more memory is needed, is >the old memory freed? I looked through the code for realloc() on my machine (System V Rel 2). The algorithm is: if( old_pointer is not free ) free( old_pointer ) new_pointer = malloc( new_size ) etc. ... Yes, the old memory is freed. ------------------------------------------------------------------- Dick Grady r4@mvuxd.att.com ...!att!mvuxd!r4