IBM Support

BIN DIRECTORY FILLING UP AFTER COMPILES OF SHARED LIBRARY

Troubleshooting


Problem

It was noticed that when a program is recompiled a number of times, the bin directory containing the executable module fills up. To free the space in the directory the 'slibclean' command has to be run. The df command shows the space is being used. But the total of what the executables should be using is not reflected in the output of the df command. Here is the way the problem happens: -The modules use shared libraries. -You have to run them at least one time after the compile. -You recompile the module and run it again. -When you do a df the space being used is increased again by the size of the module but ls still shows just the one module. -You can keep doing this until the file system fills. -You are then required to do a slibclean to get back to be using just the size of your one module.

Resolving The Problem

You are building shared libraries. The system never unloads shared libraries on its own (even after programs that use them stop). Each time you rebuild your library, the system has to load a new
version of it.

The fact that the old shared library is removed from the file system doesn't mean its space is freed. AIX has to hold onto all files from which code in memory was originally loaded for paging purposes. The net result is that with each successive edit/test cycle, you add yet another version of your library to the shared library memory segment.

You can see if this is the problem by running "genkld" as root to see what shared libraries are in memory. If any of the file names look like products of your builds, try running "slibclean" and see if your file system frees up some space.


The slibclean removes all libraries from the shared memory segment. If the system was highly active in loading libraries, the least used libraries would be pushed out of memory automatically when space is needed in segment 15 which is the library segment. When the library is removed the disk will clean up.

NOTE: genkld is harmless in that it only prints information but doesn't change anything (despite 'gen' in its name). slibclean is also safe because it only unloads shared libraries that have a reference count of zero.

This shared library "problem" can be avoided altogether during code development by marking the libraries as not shareable after building them. All you have to do is run command "chmod go-rx" against the library.


[{"Product":{"code":"SSAL2T","label":"TXSeries for Multiplatforms"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Usability","Platform":[{"code":"PF002","label":"AIX"}],"Version":"5.1;6.0;6.1;6.2;7.1;8.1;8.2","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
02 August 2018

UID

swg21045351