Memory allocator : bget or slob ?

cafe-alpha

Established Member
In today's Saturn libraries (libyaul, iapetus), slob is used as memory allocator, while good old program made by Rockin-B around 10 years ago use bget -> what do you think about theses memory allocators ?
 
From the Linux documentation provided, I ported over the SLOB allocator (GPL to MIT). It's just a K&R memory allocator, but with multiple levels. Depending on the size requested, it puts it in the appropriate "level". From there, first and next fit algorithms is used to service the request.

I never heard of bget, but I'll look into it.

It all really depends on your usage and how big your requests are going to be. SLOB isn't good for large requests (say, you want to allocate 32KiB, for example).

In terms of performance, typically the allocations would be done when you're loading assets/preparing the scene. You wouldn't allocate memory during actual game play.
 
Thank you for the informations :)
I personally use bget, because its code size is slightly smaller than slob.
However, I didn't compared bget/slob performances, but I suppose slob is better.

In terms of performance, typically the allocations would be done when you're loading assets/preparing the scene. You wouldn't allocate memory during actual game play.

Basically, I use memory allocation when loading/converting level data, but not during game.
 
In reference to LoC? SLOB has less AFAIK.

There are fancier features in BGET. One key difference is that the pools of memory are statically allocated for SLOB, but it looks like you have the ability to expand the size of the pools during run-time.

My thought process is that if you're at the point where the statically allocated pool is too small, either resize it in the headers, or rethink about your memory consumption.

The key is that we don't have paged memory and a kernel to manage it all.
 
Back
Top