If you set LD_PRELOAD
to the path of a shared object, that file will be loaded before any other library (including the C runtime, libc.so
). So to run ls
with your special malloc()
implementation, do this:
$ LD_PRELOAD=/path/to/my/malloc.so /bin/ls
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…