Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Dicebot via Digitalmars-d-learn
On Monday, 19 May 2014 at 21:01:52 UTC, monarch_dodra wrote: Huh, will it also make possible to call `realloc` if capacity is exceeded? AFAIK, using the "GC.realloc" (or "GC.extent") function on it directly would not work. This may or may not be an issue with how "GC.realloc" is designed. The

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 19 May 2014 at 18:51:31 UTC, Dicebot wrote: If it still resorts to GC in this case, utility of such addition sounds questionable. It's not really an "addition" as much as it is a "necessary building block to make higher order GC functions work": For example, "dup" was recently made

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On Mon, 19 May 2014 14:46:59 -0400, monarch_dodra wrote: On Monday, 19 May 2014 at 13:55:00 UTC, Steven Schveighoffer wrote: On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: This issue puts std.array.array to a disadvantage compared to proper slices because array() involves the

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Dicebot via Digitalmars-d-learn
On Monday, 19 May 2014 at 13:44:45 UTC, monarch_dodra wrote: Recently, a new function in druntime was added: "_d_newarrayU". This void allocates a new array *with* appendable information. We can hope it will be given a more formal and public interface, and it would then be useable by array and

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 19 May 2014 at 13:55:00 UTC, Steven Schveighoffer wrote: On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: This issue puts std.array.array to a disadvantage compared to proper slices because array() involves the following call chain, the last of which does call GC.malloc:

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Ali Çehreli via Digitalmars-d-learn
On 05/19/2014 06:55 AM, Steven Schveighoffer wrote: > On Mon, 19 May 2014 09:44:44 -0400, monarch_dodra >> Recently, a new function in druntime was added: "_d_newarrayU". > Cool, I didn't know this! Thank you both! This information may be mentioned during a lightning talk at DConf. ;) Ali

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On Mon, 19 May 2014 09:44:44 -0400, monarch_dodra wrote: On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: We know that most of the time memory is allocated more than the requested amount. Is there a way to take advantage of that extra trailing space? (And potentially the pages t

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: We know that most of the time memory is allocated more than the requested amount. Is there a way to take advantage of that extra trailing space? (And potentially the pages that come after that.) import core.memory; void main() {

Is it possible to assumeSafeAppend malloced memory?

2014-05-18 Thread Ali Çehreli via Digitalmars-d-learn
We know that most of the time memory is allocated more than the requested amount. Is there a way to take advantage of that extra trailing space? (And potentially the pages that come after that.) import core.memory; void main() { const count = 1; // I think there is extra capacity beyo