CvMemStorage 内存储存器

来源:互联网 发布:最大的mac论坛 编辑:程序博客网 时间:2024/04/28 08:57

CvMemStorage  内存储存器,双向链表,OpenCV以此统一管理动态内存。

/* Creates new memory storage.
   block_size == 0 means that default,
   somewhat optimal size, is used (currently, it is 64K) */
CVAPI(CvMemStorage*)  cvCreateMemStorage( int block_size CV_DEFAULT(0));创建一个内存储存器,block_size对应内存存储器每个内存块的大小。默认为0,默认大小为64k。

/* Releases memory storage. All the children of a parent must be released before
   the parent. A child storage returns all the blocks to parent when it is released */
CVAPI(void)  cvReleaseMemStorage( CvMemStorage** storage );释放内存储存器的所有内存空间。

/* Clears memory storage. This is the only way(!!!) (besides cvRestoreMemStoragePos)
   to reuse memory allocated for the storage - cvClearSeq,cvClearSet ...
   do not free any memory.
   A child storage returns all the blocks to the parent when it is cleared */


CVAPI(void)  cvClearMemStorage( CvMemStorage* storage );清空内存存储器。它与cvReleaseMemStorage的区别在于,它仅将释放的内存返还给内存存储器,并不返还给

系统。可方便重复使用内存存储器中的内存空间。