On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote:
On Tue, Mar 16, 2021 at 11:28:00PM +, mw via
Digitalmars-d-learn wrote: [...]
suppose:
double[] data; // D type: dynamic array
As of 2021 what's the correct way to allocate and deallocate
(free memory to the system immediatel
On Thursday, 18 March 2021 at 17:57:30 UTC, Patrick Schluter
wrote:
It's important to understand that [] is just a practical syntax
for a fat pointer.
Thinking of [] just as a fancy pointer helps imho to clarify
that the pointed to memory nature is independant of the pointer
itself.
I think
On Thursday, 18 March 2021 at 21:21:37 UTC, Paul Backus wrote:
The source code is here: https://github.com/p0nce/d-idioms/
Thanks for the answer. But it's more complex than I thought.
Something like Latex was in my mind.
On Thursday, 18 March 2021 at 18:48:26 UTC, Vinod K Chandran
wrote:
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat
wrote:
I made this article to clear up that point:
https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property
Sorry for this off-topic question.
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat
wrote:
I made this article to clear up that point:
https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property
Sorry for this off-topic question. I am amazed with eye catchy
look of that d-idioms page. I want to cr
On Wednesday, 17 March 2021 at 16:20:06 UTC, Steven Schveighoffer
wrote:
It's important to understand that [] is just a practical syntax
for a fat pointer.
Thinking of [] just as a fancy pointer helps imho to clarify that
the pointed to memory nature is independant of the pointer itself.
On 3/17/21 10:21 AM, jmh530 wrote:
> That's a little advanced, I think. And you also have
> http://ddili.org/ders/d.en/slices.html
> saying that slices are just another name for dynamic arrays.
I don't fully agree with myself there. :) Slices are interfaces to many
different kinds of consecutiv
On Wednesday, 17 March 2021 at 16:32:28 UTC, Ali Çehreli wrote:
On 3/17/21 3:54 AM, jmh530 wrote:
On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote:
double[] data;
data = cast(double[]) malloc(n * double.sizeof)[0 .. n];
This is one of those things that is not explained w
On Wednesday, 17 March 2021 at 16:20:06 UTC, Steven Schveighoffer
wrote:
[snip]
I've had online battles about this terminology, and people
asked me to change my array article to disavow this
distinction, but I'm not going to change it. It's so much
easier to understand.
-Steve
I'll be on
On 3/17/21 3:54 AM, jmh530 wrote:
On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote:
double[] data;
data = cast(double[]) malloc(n * double.sizeof)[0 .. n];
This is one of those things that is not explained well enough.
I have something here:
http://ddili.org/ders/d.en
On 3/17/21 12:06 PM, jmh530 wrote:
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote:
On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote:
This is one of those things that is not explained well enough.
Yes.
I made this article to clear up that point:
https://p0nce.gi
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat
wrote:
On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote:
This is one of those things that is not explained well enough.
Yes.
I made this article to clear up that point:
https://p0nce.github.io/d-idioms/#Slices-.capacity,-
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat
wrote:
On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote:
This is one of those things that is not explained well enough.
I want just to add, case 3 is wrong usage.
Right one is:
GC.free(GC.addrOf(ar.ptr));
On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote:
This is one of those things that is not explained well enough.
Yes.
I made this article to clear up that point:
https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property
"That a slice own or not its memory is purel
On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote:
[snip]
Note that T[] is just a slice, not the dynamic array itself.
The dynamic array is allocated and managed by the GC when you
append stuff to it, or when you create a new array with `new`
or an array literal.
None of the latte
On Tue, Mar 16, 2021 at 11:28:00PM +, mw via Digitalmars-d-learn wrote:
[...]
> suppose:
>
> double[] data; // D type: dynamic array
>
> As of 2021 what's the correct way to allocate and deallocate (free
> memory to the system immediately) D's dynamic array?
[...]
Note that T[] is just a
On Monday, 30 December 2013 at 08:13:30 UTC, bearophile wrote:
How to free memory to the system immediately?
What is your use case?
The use case is: we want deterministic memory management, (and
the application data is too big to fit into memory at once, so
have to be processed batch by bat
On Monday, 30 December 2013 at 06:52:20 UTC, Ilya Yaroshenko
wrote:
case 1:
delete ar;
case 2:
ar.destroy();
case 3:
GC.free(ar.ptr);
case 4:
ar = null;// (assumed that ar is only one pointer to the same
array)
What is the difference?
How to free memory to the system immediately?
It dep
Answer will make more sense if ar is assumed to be any
heap-allocated object, not just dynamic array.
On Monday, 30 December 2013 at 06:52:20 UTC, Ilya Yaroshenko
wrote:
case 1:
delete ar;
Deprecated. Used to call destructor and GC.free after that
case 2:
ar.destroy();
Current solution
Ilya Yaroshenko:
case 1:
delete ar;
It's deprecated.
case 4:
ar = null;// (assumed that ar is only one pointer to the same
array)
It's the simpler way.
How to free memory to the system immediately?
What is your use case?
Bye,
bearophile
case 1:
delete ar;
case 2:
ar.destroy();
case 3:
GC.free(ar.ptr);
case 4:
ar = null;// (assumed that ar is only one pointer to the same
array)
What is the difference?
How to free memory to the system immediately?
___
Thank You & Best Regards,
Ilya
21 matches
Mail list logo