Memory allocation purity

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Wed May 14 18:33:34 PDT 2014


On Wednesday, 14 May 2014 at 22:50:10 UTC, w0rp wrote:
> I think even C malloc should be considered pure. True, it 
> affects global state by allocating memory, but it never changes 
> existing values, it just allows for new values. free is pure 
> because it isn't side-effecting, it deallocates what you give 
> it. That's just my perspective on it though, others might have 
> other views on it.

`free` is not pure, because if you have a reference to that 
memory that reference is no longer valid.


More information about the Digitalmars-d mailing list