[ENet-discuss] boost.pool & enet

Beau Albiston albiston at cynergy.com
Sat Jul 22 21:35:56 PDT 2006

The only time I have ever ran into a fragmentation problem with a memory 
manager was when allocating very large, variable sized chunks of memory 
(which is probably the worst case for most MMs).  If your protocol 
consists of many small, same-size packet types, then it's probably 
redundant to implement a pool system.  However, there are other 
instances where you may want the overhead in order to have some other 
structural feature that the MM doesn't provide, like linked blocks 
(linked list, skip list, etc), and the one you mentioned (deallocating 
large swaths of memory blocks at once--although, running a destructor 
for each block is suspect).

Now that enet allows you to set the packet data pointer, hooking up a 
pool system should be really easy.


Zola wrote:
> Hello,
> I'm examining enet as a base of network code for a project which will 
> have potentially hundreds of users in concentrated areas at certain 
> times; I have one concern here- fragmentation, and the servers should 
> be able to keep long-running uptimes. I forsee a barrage of tiny 
> allocations and frees happening, and I'm concerned about fragmentation.
> A pool allocator might solve this problem.
> Has anyone tried, or been successful in using enet with the boost pool 
> allocator?
> It can be found here: http://www.boost.org/libs/pool/doc/index.html 
> <http://www.boost.org/libs/pool/doc/index.html>
> As stated:
> "Pools are generally used when there is a lot of allocation and 
> deallocation of small objects."
> "Using Pools gives you more control over how memory is used in your 
> program. For example, you could have a situation where you want to 
> allocate a bunch of small objects at one point, and then reach a point 
> in your program where none of them are needed any more. Using pool 
> interfaces, you can choose to run their destructors or just drop them 
> off into oblivion; the pool interface will guarantee that there are no 
> system memory leaks."
> Has anyone had experiences with this combination of enet and pool 
> allocators, or boost's pool?
> And, is enet suited to be plugged into such a system?
> - Zola
> ------------------------------------------------------------------------
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss

More information about the ENet-discuss mailing list