home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / hp / 12712 < prev    next >
Encoding:
Internet Message Format  |  1992-11-09  |  1.5 KB

  1. From: dds@hpcndfa.CND.HP.COM (Darren Smith)
  2. Date: Mon, 9 Nov 1992 17:54:01 GMT
  3. Subject: Re: Is it safe to free() mem alloc'd by xdr routines?
  4. Message-ID: <1730144@hpcndfa.CND.HP.COM>
  5. Organization: HP Network and System Management Division
  6. 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
  7. Newsgroups: comp.sys.hp
  8. References: <1992Nov5.081038.1639@codex.oz.au>
  9. Lines: 26
  10.  
  11. |There are some "issues" ;-) with malloc/free and items created by/with
  12. |xdr et al.  As part of the port of SPEC SFS 1.0 (LADDIS) to HP-UX, I
  13. |replaced the calls to free() with _rpc_free() for those places where I
  14. |knew the memory was allocated by xdr...
  15.  
  16. This is actually the right thing to do.  There are actually a few options
  17. that you can use:
  18.  
  19. 1) In the name of portability, use the mem_alloc()/mem_free() macros 
  20. defined in <rcp/types.h>.  This will map to _rpc_malloc()/_rpc_free() on
  21. HP-UX, and malloc()/free() on Sun and others.
  22.  
  23. 2) Create your own functions _rpc_malloc() and _rpc_free() that are linked
  24. into your program that just call malloc/free, only used on HP-UX.
  25.  
  26. 3) Ifdef your code for HP-UX to directly call _rpc_malloc() and _rpc_free().
  27.  
  28. NOTE: The latter two are probably not recommended since the special
  29. rpc functions could go away in the future.
  30.  
  31. DISCLAIMER:  This is not an official statement by HP.  I speak solely
  32. for myself.
  33.  
  34. --
  35. Darren Smith     dds@cnd.hp.com     229-2536   Network and System Management Div.
  36. --
  37.