Re: о куче
От: Lazy Cjow Rhrr Россия lj://_lcr_
Дата: 09.12.05 09:19
Оценка:
Здравствуйте, Павел Лазаревич, Вы писали:

PD> Custom allocator?


У Александреску свой аллокатор для маленьких объектов очень эффективен, можно взять его реализацию.

The allocator implemented by Loki has a four-layered architecture. The first layer consists of a
private type Chunk, which deals with organizing memory chunks in equally sized blocks. The
second layer is FixedAllocator, which uses a variable-length vector of chunks to satisfy
memory allocation to the extent of the available memory in the system. In the third layer,
SmallObjAllocator uses multiple FixedAllocator objects to provide allocations of any
object size. Small objects are allocated using a FixedAllocator, and requests for large objects
are forwarded to ::operator new. Finally, the fourth layer consists of SmallObject, a class
template that wraps a SmallObjAllocator object.


Для средних используем штатный new/delete;

А для больших сделать страничные аллокации, как предлагаете вы.

Чисто умозрительно рассуждая, должно получиться очень неплохо.
quicksort =: (($:@(<#[),(=#[),$:@(>#[)) ({~ ?@#)) ^: (1<#)
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.