[Issue 17881] Provide mechanism to preallocate memory from the GC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 11 18:37:32 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17881

--- Comment #8 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to safety0ff.bugz from comment #7)
> I think the API should obviously should have the size of the elements as a
> separate arguments and provide as much information as malloc e.g.:
> GC.preload(size_t num, size_t size, uint ba = 0, const TypeInfo ti = null)

Internally, I think something like this is needed. What I am looking for,
though, is the high-level API of "I have 20 million T's I want to allocate,
give me them properly allocated and typed one at a time". I don't necessarily
even think you need the TypeInfo for the low level API. Perhaps the bit
attributes can even be done as you allocate each block.

--


More information about the Digitalmars-d-bugs mailing list