std.container / tightArray / class (de)allocators

Stephan spam at extrawurst.org
Wed Jun 16 01:04:05 PDT 2010


On 16.06.2010 08:59, Andrei Alexandrescu wrote:
> Robert M. Münch wrote:
>> On 2010-06-15 09:49:29 +0200, Robert M. Münch said:
>>
>>> Hi, since std.container is now part of the DMD compiler and class
>>> allocators/deallocaters are no longer part of the language, the way
>>> to go now, as far as I understand now, it to use tightArray.
>>>
>>> So, how to use tightArray to allocate structs and classes from a
>>> specific memory pool? Will such allocations be under GC control or not?
>>>
>>> For example: How do I ensure that an allocation is done from a
>>> memory-mapped file area?
>>
>> Has noone a tipp for me how to make & use an own allocator?
>
> Sorry for being slow on that. Currently TightArray (renamed to Array)
> uses hardcoded calls to malloc and free. I'd be glad to use a better
> design if one came along.
>
> Andrei
>

Btw. I downloaded the new dmd(2047) and tried to use this new Array 
template. But it does not seem to work:

import std.container;

void main()
{
	Array!(int) a;
}

//src\phobos\std\container.d(1660): Error: function 
core.stdc.stdlib.free (void* ptr) is not callable using argument types 
(int[])
//src\phobos\std\container.d(1660): Error: cannot implicitly convert 
expression ((*this._data)._payload) of type int[] to void*


is it my fault? does anyone else have this problem?


More information about the Digitalmars-d mailing list