Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xtfree(3) [hpux man page]

XtFree()																  XtFree()

Name
  XtFree - free allocated memory.

Synopsis
  void XtFree(ptr);
	 char *ptr;

Inputs
  ptr	    Specifies the address of the allocated memory to be freed.

Description
  XtFree()  frees  a  block of memory previously allocated by XtMalloc(), XtRealloc(), XtCalloc(), XtNew() or XtNewString() so that it can be
  reused by the system.

  If ptr is NULL, XtFree() returns immediately.

Usage
  The ptr argument is of type char *.  In many cases, you will have to cast the data you are freeing to this type in order to  avoid  warning
  messages from your compiler.

  A  number  of  Xt  functions return strings or other values that must be freed with XtFree() when the caller will no longer need them.  You
  should be sure to check the documentation of any function that returns a value to find out who "owns" the memory and	who  is  expected  to
  free it.

  Calling  the	Toolkit's XtMalloc() and XtFree() is more portable and provides better error checking than calling system-specific malloc and
  free.  You should not use XtFree() on memory that was allocated with malloc() or other non-Xt memory allocation routines.

See Also
  XtCalloc(1), XtMalloc(1), XtNew(1), XtNewString(1), XtRealloc(1).

Xt - Memory Allocation															  XtFree()

Check Out this Related Man Page

XtMalloc(3)							   XT FUNCTIONS 						       XtMalloc(3)

NAME
XtMalloc, XtCalloc, XtRealloc, XtFree, XtNew, XtNewString - memory management functions SYNTAX
char *XtMalloc(Cardinal size); char *XtCalloc(Cardinal num, Cardinal size); char *XtRealloc(char *ptr, Cardinal num); void XtFree(char *ptr); type *XtNew(type); String XtNewString(String string); ARGUMENTS
num Specifies the number of bytes or array elements. ptr Specifies a pointer to the old storage or to the block of storage that is to be freed. size Specifies the size of an array element (in bytes) or the number of bytes desired. string Specifies a previously declared string. type Specifies a previously declared data type. DESCRIPTION
The XtMalloc 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, XtMalloc calls XtErrorMsg. The XtCalloc 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, XtCalloc calls XtErrorMsg. The XtRealloc 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, XtRealloc calls XtErrorMsg. If ptr is NULL, XtRealloc allocates the new storage without copying the old contents; that is, it simply calls XtMalloc. The XtFree function returns storage and allows it to be reused. If ptr is NULL, XtFree returns immediately. XtNew returns a pointer to the allocated storage. If there is insufficient memory to allocate the new block, XtNew calls XtErrorMsg. XtNew is a convenience macro that calls XtMalloc with the following arguments specified: ((type *) XtMalloc((unsigned) sizeof(type)) XtNewString returns a pointer to the allocated storage. If there is insufficient memory to allocate the new block, XtNewString calls XtEr- rorMsg. XtNewString is a convenience macro that calls XtMalloc with the following arguments specified: (strcpy(XtMalloc((unsigned) strlen(str) + 1), str)) SEE ALSO
X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.0.5 XtMalloc(3)
Man Page

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to change File Description

When I am browsing the web and I end up in a directory with no HTML index file (ie index.html), I see something like this: Index of /k Name Last modified Size Description -------------------------------------------------------------------- 115-1564_CRW.jpg ... (4 Replies)
Discussion started by: PearPie
4 Replies

2. Programming

how can i verify and captalise my first character of string

Hi , With some modification in below , I would like to verify my first char of string weather it is capital letter or not, if it is not than i would like to capitalize it some body help me in modifying codethis code: text = XmTextGetString(crn1_text_modname); if ( ( text == ' ' ||... (1 Reply)
Discussion started by: jagan_kalluri
1 Replies

3. Shell Programming and Scripting

What is solution for this error?

Hi all, I am trying to run one model which contains many functions, If I use file below 1MB it works fine but If I use more than 1 MB getting following error Please give me some solution OS : Ubuntu 32-bit 12.04 LTS *** glibc detected *** awk: double free or corruption (out): 0x08ac8768... (27 Replies)
Discussion started by: Akshay Hegde
27 Replies

4. Shell Programming and Scripting

Replace a multi-line strings or numbers

Hi I have no experience in Unix so any help would be appreciated I have the flowing text 235543 123 45654 199 225 578 45654 199 225 I need to find this sequence from A file 45654 199 225 (22 Replies)
Discussion started by: khaled79
22 Replies

5. Shell Programming and Scripting

Help with script

Hi the following code if working fine for small file for i in 200 202 203 do SEQ=$ gawk -v S="$SEQ" ' { A = $1 } END { for ( i = 1; i <= c; i++ ) { if ( A == S ) ... (1 Reply)
Discussion started by: khaled79
1 Replies

6. UNIX for Beginners Questions & Answers

Change text font to greater one in this very good MOTIF texteditor ?

Hi, i have here found a very good texteditor source code programmed in the MOTIF GUI language. For myself i need NOTHING else to program. To start from a very easy point of view i want to RUN this editor on my LINUX machine and type simple C code. The reason for this post is that the text... (7 Replies)
Discussion started by: Sennenmut
7 Replies