[ENet-discuss] boost.pool & enet
kevin.gadd at gmail.com
Sun Jul 23 11:57:27 PDT 2006
Unless destruction notification was added for packets since the last time I
checked, setting up a pool system using the existing data pointer mechanism
will be impossible. The data pointer mechanism is currently only useful if
you have constant data somewhere that can be used by the packet, otherwise
you have no way to know how long that packet will be alive for, and cannot
safely deallocate the memory.
However, since the custom allocation code is there, it should be fairly
straightforward to dive into the codebase and tweak the
allocation/deallocation code to support using a pool allocator, I think.
On 7/22/06, Beau Albiston <albiston at cynergy.com> wrote:
> 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
> ENet-discuss mailing list
> ENet-discuss at cubik.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ENet-discuss