will .length=0 clear memory
Jarrett Billingsley
jarrett.billingsley at gmail.com
Wed Nov 5 21:46:11 PST 2008
On Thu, Nov 6, 2008 at 12:02 AM, Big Bill <bigdorkyb at tengu.com> wrote:
> i just wonder here,
>
> free(x); will free contents of x, but will x.length=0 free memory too?
free(x) doesn't clear the contents of x. In fact it's completely
illegal and I'm surprised your compiler allows it. Not only can
arrays not be implicitly cast to pointers, but free() is a C stdlib
function, and using free() to free memory allocated by the D GC is a
terrible idea.
Did you mean "delete x;"?
More information about the Digitalmars-d-learn
mailing list