473,757 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

boost::pool library question

Hi,

I have question regarding the pool library.
In my application I read a lot of data records from a database
into a small data class and therefor I thought object_pool could help me
to reduce memory consumption.

So I wrote:

class OuterClass
{
...
class row{
...
private:
...
static boost::object_p ool<OuterClass: :row> p;
};
};

In OuterClass.cc I do

boost::object_p ool<OuterClass: :row> OuterClass::row ::p;

inline void * OuterClass::row ::operator new(size_t size){
return p.malloc();
}

inline void OuterClass::row ::operator delete(void *p, size_t size){
}
The code works.
However, every time I instantiate a OuterClass::row p.malloc is called.

Is there a way to reduce the calls to p.malloc ?
Normally I know the rough number of rows I fetch from the database,
say 100.000 .
So it would be a great thing to allocate memory for
10.000 * sizeof(OuterCla ss::row) and later only to glide on this
memory chunk.

Can anyone give me a hint if and how to achieve that ?

Thomas
Jul 19 '05 #1
0 2152

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1388
by: KPB | last post by:
If I were to post code here that included stuff from *boost*, would the code get gigged for non-StdC++ compliance. I would think yes but maybe *boost* is a bit of a gray area on this NG. Thanks, KPB
8
2075
by: googlebart2000 | last post by:
I'm about to be a new user of the Boost C++ library, and I've installed and compiled it, but I've come up empty on how to use it in my C++ programs. I can't find the documentation that explains which library (name? location?) to use for the uBLAS portion. Can anyone point me to some simple examples somewhere? Advance thanks, -ted in AZ
2
5025
by: Jens Hibbeler | last post by:
Hello, I am trying to compile the Boost library with the Borland Builder 6 enviorement. But it seems that it is not possible to use the Thread library which is especealli important for me. Has anyone compiled the library successfully? What I have done: 1) Updated Borland Builder with update 4 2) Dowloaded Boost 1.33 3) Started Build.bat
3
13013
by: Andreas S. | last post by:
Hi, I don't any solution any more... I have written a small tool wich uses the boost library. It compiles fine, but I can't link it. I am on a Fedora Core 6 x86_64 system. The boost library is installed with "yum install boost" - so this should be fine. ldconfig | grep boost gives me a list with all the installed boost libraries, including the two (libboost_filesystem.so and
2
8786
by: soren.andersen | last post by:
Hello out there :-) I'm new to c++, coming from Java, and trying to learn the basics of the language and all that, basically just for fun. :-) So, when once I played around with c++ a bit i found out I didn't really have any ways of looking at directories. So, I looked around and found the boost library, which seems pretty cool. However, I seem to be unable to compile anything using these libraries.
5
1547
by: Sarath | last post by:
Hi All, I've created a new group for discussing about boost library. If you are interested please join with it http://groups.google.com/group/boost-library Thanks.
1
1989
by: werasm | last post by:
Hi, This is not boost related per sé, therefore I'm posing the question here. I need to do many small object allocations, and I'm considering using boost::pool for this. I've contemplated using Coplien's CRTP to encapsulate the allocation/de-allocation and the pool per type. Does anybody see a potential caveat here? One potential caveat
1
2928
by: kundasang | last post by:
Hi. I just downloaded boost library from boost.org then build and I don't know what does binary precompiled means. Well, I have installed it and I using bloodshed Dev-Cpp compiler. <bThen, I opened the boost_1_34_1 folder and then I copy the boost. </b>
4
3373
by: mavrik | last post by:
Hi all, I've a requirement of creating a memory pool for all memory needed by my application, when my application starts. And I should take all memory from that pool without returning to the System. This pool should get destructed only when application terminates. So memory usage of my application will remian constant. For this purpose, I am planning to use Boost Pool Library. Can anybody help me in using Boost library. Is Boost right...
6
13858
by: Juha Nieminen | last post by:
I tested the speed of a simple program like this: //------------------------------------------------------------ #include <list> #include <boost/pool/pool_alloc.hpp> int main() { typedef std::list<intList_t; // default allocator //typedef std::list<int, boost::pool_allocator<int List_t;
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.