


XtMalloc(3Xt)							XtMalloc(3Xt)
X11R5									X11R5



NAME
  XtMalloc, XtCalloc, XtRealloc, XtFree, XtNew,	XtNewString - memory manage-
  ment functions

SYNTAX
  char *XtMalloc(_s_i_z_e);
	Cardinal _s_i_z_e;

  char *XtCalloc(_n_u_m, _s_i_z_e);
	Cardinal _n_u_m;
	Cardinal _s_i_z_e;

  char *XtRealloc(_p_t_r, _n_u_m);
	char *_p_t_r;
	Cardinal _n_u_m;

  void XtFree(_p_t_r);
	char *_p_t_r;

  _t_y_p_e *XtNew(_t_y_p_e);
	_t_y_p_e;

  String XtNewString(_s_t_r_i_n_g);
	String _s_t_r_i_n_g;

ARGUMENTS

  _n_u_m	    Specifies the number of bytes or array elements.

  _p_t_r	    Specifies a	pointer	to the old storage or to the block of storage
	    that is to be freed.

  _s_i_z_e	    Specifies the size of an array element (in bytes) or the number
	    of bytes desired.

  _s_t_r_i_n_g    Specifies a	previously declared string.

  _t_y_p_e	    Specifies a	previously declared data type.

DESCRIPTION
  The _X_t_M_a_l_l_o_c functions returns a pointer to a	block of storage of at least
  the specified	size bytes.  If	there is insufficient memory to	allocate the
  new block, _X_t_M_a_l_l_o_c calls _X_t_E_r_r_o_r_M_s_g.

  The _X_t_C_a_l_l_o_c function	allocates space	for the	specified number of array
  elements of the specified size and initializes the space to zero.  If	there
  is insufficient memory to allocate the new block, _X_t_C_a_l_l_o_c calls _X_t_E_r_-
  _r_o_r_M_s_g.

  The _X_t_R_e_a_l_l_o_c	function changes the size of a block of	storage	(possibly
  moving it).  Then, it	copies the old contents	(or as much as will fit) into
  the new block	and frees the old block.  If there is insufficient memory to
  allocate the new block, _X_t_R_e_a_l_l_o_c calls _X_t_E_r_r_o_r_M_s_g.  If ptr is NULL,
  _X_t_R_e_a_l_l_o_c allocates the new storage without copying the old contents;	that
  is, it simply	calls _X_t_M_a_l_l_o_c.

  The _X_t_F_r_e_e function returns storage and allows it to be reused.  If ptr is
  NULL,	_X_t_F_r_e_e returns immediately.

  _X_t_N_e_w	returns	a pointer to the allocated storage.  If	there is insufficient
  memory to allocate the new block, _X_t_N_e_w calls	_X_t_E_r_r_o_r_M_s_g.  _X_t_N_e_w is a	con-
  venience macro that calls _X_t_M_a_l_l_o_c with the following	arguments specified:

  ((type *) XtMalloc((unsigned)	sizeof(type))

  _X_t_N_e_w_S_t_r_i_n_g returns a	pointer	to the allocated storage.  If there is insuf-
  ficient memory to allocate the new block, _X_t_N_e_w_S_t_r_i_n_g	calls _X_t_E_r_r_o_r_M_s_g.
  _X_t_N_e_w_S_t_r_i_n_g is a convenience macro that calls	_X_t_M_a_l_l_o_c with the following
  arguments specified:

  (strcpy(XtMalloc((unsigned) strlen(str) + 1),	str))

SEE ALSO
  _X _T_o_o_l_k_i_t _I_n_t_r_i_n_s_i_c_s - _C _L_a_n_g_u_a_g_e _I_n_t_e_r_f_a_c_e
  _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e

















































