glob, globfree - find pathnames matching a pattern, free memory from
glob()
SYNOPSIS
#include <glob.h>
int glob(const char *pattern, int flags,
int (*errfunc) (const char *epath, int eerrno),
glob_t *pglob)
void globfree(glob_t *pglob)
DESCRIPTION
The glob() function searches for all the pathnames matching pattern
according to the rules used by the shell (see glob(7)). No tilde
expansion or parameter substitution is doneif you want these, use
wordexp(3).
The globfree() function frees the dynamically allocated storage from an
earlier call to glob().
The results of a glob() call are stored in the structure pointed to by
pglob. This structure is of type glob_t (declared in <glob.h>) and
includes the following elements defined by POSIX.2 (more may be present
as an extension):
typedef struct {
size_t gl_pathc /* Count of paths matched so far */
char **gl_pathv /* List of matched pathnames. */
size_t gl_offs/* Slots to reserve in gl_pathv. */
} glob_t
Results are stored in dynamically allocated storage.
=============================================================
glob就是模式匹配查找,早期linux中的函数,globfree就是将glob中用到的内存(glob因为要查找,会用到一些内存来记录查找内容什么的)释放。
学编程特别是研究linux底层c,英文不好怎么行。
你好,方法如下:1. 安装Google Logging Library(glog)
glog 下载地址
安装命令如下所示
# 解压tar -zxvf glog-0.3.3.tar.gz# 切换路径cd glog-0.3.3sudo ./configuresudo make –jsudo make install
2. 安装其它依赖
执行以下命令即可。
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler protobuf-c-compiler python-pandas
3. 编辑Makefile.config文件
*** 作命令如下所示。
unzip caffe-master.zip #本地解压caffe-master#切换路径cd /caffe-master #caffe源文件中没有Makefile.config,需要复制Makefile.config.examplecp Makefile.config.example Makefile.config#编辑Makefile.configvi Makefile.config
修改Makefile.config
PYTHON_LIB := /usr/local/libMATLAB_DIR := /usr/local/MATLAB/R2014a
取消第5行的注释,即将 #USE_CUDNN=1 改为 USE_CUDNN=1;
如果使用本教程系列安装的,就不需要修改BLAS=atlas,如果是参考欧新宇的教程,安装了MKL,需要改成BLAS=mkl;
启用CUDNN,加注释: CPU_ONLY:=1 改成 # CPU_ONLY:=1;
配置路径,实现caffe对Python和Matlab接口的支持:
4. 编辑Makefile文件
如果openCV版本是2.4.x,此小节可以不再阅读
如果openCV版本3.0,还需要修改Makefile文件,实现对OpenCV 3.x的支持。
在Makefile文件中查找“Derive include and lib directories”一节,修改“LIBRARIES +=”的最后一行,增加opencv_imgcodecs,修改之后为:
LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
5. 编译caffe-master
依次执行下面的命令,编译caffe:
make all -jmake test -jmake runtest -j
runtest执行结束之后,如下图所示。这样子就说明安装成功了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)