Swift does away with pointers == pervasive ARC

via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 17 12:19:54 PDT 2014


On Tuesday, 17 June 2014 at 18:39:46 UTC, Walter Bright wrote:
> If an app can be cheaply restarted, an easy & fast way to do 
> memory allocation is to use a "bump allocator" like dmd does, 
> and then restart when it runs out of memory.
>
> I'm not joking, this can actually be very practical for certain 
> kinds of programs.

I think it was common to use a region allocator in ray tracing, 
per ray-path. Meaning you calculate the worst case memory 
consumption and malloc one big block (or put it in a segment in 
the exec), then just move a pointer ahead for allocations, and 
reset the pointer before you fire the next ray from the camera.

iOS ARC do use Autorelease Pool Blocks which takes care of 
release() at the end of the event loop. That probably affects ARC 
implementation/code gen. It basically means that you don't 
release allocated memory except at the end of an iteration. That 
won't work very well in D though?

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html


More information about the Digitalmars-d mailing list