Can somebody tell me how to use __attribute__ cleanup? Here is my (not working) code: #include <stdio.h> void cleanup_int(int *pInt) { printf("Cleaning %d\n", *pInt); } int main() { int count __attribute__ ((cleanup (cleanup_int)))=3; int ii; for(ii=0; ii<count; ii++) printf("ii = %d\n", ii); return 0; } And output from the console: [justinc@cepin gcc_cleanup]$ make && ./test_cleanup gcc test_cleanup.c -o test_cleanup test_cleanup.c: In function `main': test_cleanup.c:11: warning: `cleanup' attribute directive ignored ii = 0 ii = 1 ii = 2 [justinc@cepin gcc_cleanup]$ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) [justinc@cepin gcc_cleanup]$