Boost logo

Boost Users :

Subject: [Boost-users] how to make Pool allocate one chunk buffer one time?
From: zhangxiaowei (dreamerzhang_at_[hidden])
Date: 2010-01-07 03:14:00


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net