Re: [xml] Action of realloc

Date view Thread view Subject view Author view

From: JohnnyXia@acersoftech.com.cn
Date: Thu Dec 07 2000 - 00:20:10 EST


Hi All,

I think of two ways to fix this problem, and post them here for discussion.

1)The most direct way, change the codes in libxml where xmlRealloc is
called.
  There are about 71 places need to be modified.

2)Rewrite xmlRealloc, when realloc fails, free the old memory block and
returns null.
  But xmlRealloc is used internally and externally. Internally it is called
by the
  lib implementation, externally it maybe called by lib user. In lib
implementation
  xmlRealloc is used as if it will clean the old memory block, when it
fails. But
  how about external usage, can make the same assumption?

Johnny Xia.

On Tue, Dec 05, 2000 at 08:21:08PM +0000, Bjorn Reese wrote:
>
> JohnnyXia@acersoftech.com.cn wrote:
>
> > pOld = realloc( pOld, newsize );
>
> You are right. If realloc() fails, then the old memory block is
> lost. This behaviour is not restricted to individual platforms,
> but a general ANSI/ISO stdlib behaviour.

  yes this is kind of unclean, but basically if the programs runs out
of memory, it will leak. That's a problem, I don't plan to fix this
immediately but I keep this in the list of things TODO. Patch welcome :-)

Daniel

--
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net

---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Dec 07 2000 - 00:43:28 EST