Valgrind学习笔记

valgrind --tool=memcheck --leak-check=yes ls -l
valgrind --leak-check=full  --track-origins=yes  --track-origins=yes  --leak-check=full --show-reachable=yes -v 
valgrind  --tool=exp-dhat  --tool=massif --tool=callgrind --tool=memcheck --leak-check=full  --track-origins=yes  --track-origins=yes  --leak-check=full --show-reachable=yes -v 

Linux查看系统使用的线程库

getconf GNU_LIBPTHREAD+VERSION

Linux下使用C语言生成bitmap

#ifndef SAVEBMP_H
#define SAVEBMP_H

#include <stdio.h>
#include <stdlib.h>

typedef long LONG;
typedef unsigned char BYTE;
typedef unsigned int DWORD;
typedef unsigned short WORD;
typedef struct {
    WORD bfType;
    DWORD bfSize;
    WORD bfReserved1;
    WORD bfReserved2;
    DWORD bfOffBits;
} BMPFILEHEADER_T;

typedef struct {
    DWORD biSize;
    DWORD biWidth;
    DWORD biHeight;
    WORD biPlanes;
    WORD biBitCount;
    DWORD biCompression;
    DWORD biSizeImage;
    DWORD biXPelsPerMeter;
    DWORD biYPelsPerMeter;
    DWORD biClrUsed;
    DWORD biClrImportant;
} BMPINFOHEADER_T;

void Snapshot(BYTE *pData, int width, int height, char *fileName, DWORD size);

#endif // SAVEBMP_H

WordPress无法定位(wp-content)的解决方法

打开WordPress根目录的wp-config.php文件,把下面这段代码加到文件末尾。

/** Override default file permissions */
if(is_admin()) {
    add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
    define( 'FS_CHMOD_DIR', 0751 );
}

Linux创建ramdisk

dd if=/dev/zero of=/dev/rd/1 bs=1k count=9216
mke2fs -vm0 /dev/rd/1 9216 
mount /dev/rd/1 /tmp/
umount -v /tmp