[ENet-discuss] Custom memory allocator

Syed Setia Pernama syedhs at yahoo.com
Tue Oct 30 11:17:55 PDT 2007


Okay thanks for the clarification Lee. So far, my app doesn't exhibit anything weird network behavior other than the ones due to my own bugs of course. It is just that at the first thought, it is quite scary thinking of freeing & allocating many2 times in a very short period, although it is most probably just pure wild imagination lol.

----- Original Message ----
From: Lee Salzman <lsalzman1 at cox.net>
To: Discussion of the ENet library <enet-discuss at cubik.org>
Sent: Tuesday, October 30, 2007 6:40:24 PM
Subject: Re: [ENet-discuss] Custom memory allocator


As far as I have ever benchmarked, the performance of GNU libc's malloc
 
is pretty optimal, and internally, as far as I know, just has buckets 
for different memory sizes which wouldn't really be any worse than a 
customized memory pool. Packets are very short lived, so they're pretty
 
much always going to be going back into the buckets as fast as they
 come 
out.

The bigger worry about a lot of packets is... bandwidth! Packets do 
require a small header, which starts to add up if you send a lot of 
little ones.

But a few hundred malloc/frees in a second is really nothing that won't
 
easily be plowed through on a modern malloc implementation. So more or 
less, unless you it shows up in your profiles, I wouldn't bother
 messing 
with it.

Lee

Syed Setia Pernama wrote:
> Hi,
> 
> I have been wanting to ask this, but always keep forgetting until
 today ;)
> 
> Enet has provided a way for you to create a custom memory allocator,
 so that means instead of 'free' and 'malloc' everytime a packet is
 created & destroyed, we can instead pull it from a memory pool for an
 example.
> This way, memory fragmentation can be reduced significantly because
 depending on the app, there could be hundreds of free & malloc pair per
 second.
> 
> I know that this is critical in game console, but I am not sure too
 sure about PC - anybody can share some story here? Eg performance,
 stability - or it doesn't matter at all? :)
> 
_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org
http://lists.cubik.org/mailman/listinfo/enet-discuss





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the ENet-discuss mailing list