home *** CD-ROM | disk | FTP | other *** search
- From: dds@hpcndfa.CND.HP.COM (Darren Smith)
- Date: Mon, 9 Nov 1992 17:54:01 GMT
- Subject: Re: Is it safe to free() mem alloc'd by xdr routines?
- Message-ID: <1730144@hpcndfa.CND.HP.COM>
- Organization: HP Network and System Management Division
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!scd.hp.com!hpscdm!cupnews0.cup.hp.com!hppad.waterloo.hp.com!hppad!hpfcso!hpcndfa!dds
- Newsgroups: comp.sys.hp
- References: <1992Nov5.081038.1639@codex.oz.au>
- Lines: 26
-
- |There are some "issues" ;-) with malloc/free and items created by/with
- |xdr et al. As part of the port of SPEC SFS 1.0 (LADDIS) to HP-UX, I
- |replaced the calls to free() with _rpc_free() for those places where I
- |knew the memory was allocated by xdr...
-
- This is actually the right thing to do. There are actually a few options
- that you can use:
-
- 1) In the name of portability, use the mem_alloc()/mem_free() macros
- defined in <rcp/types.h>. This will map to _rpc_malloc()/_rpc_free() on
- HP-UX, and malloc()/free() on Sun and others.
-
- 2) Create your own functions _rpc_malloc() and _rpc_free() that are linked
- into your program that just call malloc/free, only used on HP-UX.
-
- 3) Ifdef your code for HP-UX to directly call _rpc_malloc() and _rpc_free().
-
- NOTE: The latter two are probably not recommended since the special
- rpc functions could go away in the future.
-
- DISCLAIMER: This is not an official statement by HP. I speak solely
- for myself.
-
- --
- Darren Smith dds@cnd.hp.com 229-2536 Network and System Management Div.
- --
-