how to make Pool allocate one chunk buffer one time?
Hi, all I am doing one video processing software, which uses Boost::pool as the buffer manager. but every time pool allocates buffers, it malloc all needed memory at one time. for example, I create one pool object for 1024 B for one chunk, and 16 chunks at first. Pool malloc all the 1024 * 16 (16KB) at one time. this leads to memory allocation error for my application, because I need 8294400B (1920 * 1080 * 4, for one video frame) * 32, that is more than 256 MB. I use default new/delete, so new returns NULL for the third time in my case. but from memory monitor, there are still enough memory free. after tracing into new, I found this is from the Microsoft memory management design and memory fragments. is there any way to set Pool to allocate one chunk by another? for example, when I want one chunk, it allocates 8294400B. and for another time, it does another. so this should solve my issues for the memory usage. after checking the code of Pool, it is all based on contiguous memory. if pool cannot meet my requirement, is there any other option in BOOST? BTW, I am working on Windows 32 bits with MS Visual Studio 2005. Thank you for any comment. Xiaowei _________________________________________________________________ 上Windows Live 中国首页,下载Messenger2009安全版! http://www.windowslive.cn
On Thu, 07 Jan 2010 09:14:00 +0100, zhangxiaowei
[...]after checking the code of Pool, it is all based on contiguous memory. if pool cannot meet my requirement, is there any other option in BOOST?
There is no option to customize the way Boost.Pool allocates memory. This is a question which is asked more often though. There is also a patch to set a max size (see https://svn.boost.org/trac/boost/ticket/2696). As Boost.Pool wasn't changed for quite some time though I'm not sure if the maintainer is busy or the library has no maintainer? Boris
On Jan 11, 2010, at 4:09 PM, Boris Schaeling wrote:
On Thu, 07 Jan 2010 09:14:00 +0100, zhangxiaowei
wrote: [...]after checking the code of Pool, it is all based on contiguous memory. if pool cannot meet my requirement, is there any other option in BOOST?
There is no option to customize the way Boost.Pool allocates memory. This is a question which is asked more often though. There is also a patch to set a max size (see https://svn.boost.org/trac/boost/ticket/2696). As Boost.Pool wasn't changed for quite some time though I'm not sure if the maintainer is busy or the library has no maintainer?
https://svn.boost.org/trac/boost/report/15 gives a list of libraries and maintainers. It shows that Chris Newbold is now maintaining the pool library. (IIRC, he took over in the last few months). -- Marshall
participants (3)
-
Boris Schaeling
-
Marshall Clow
-
zhangxiaowei