ispc/ispc — Issue #139: Add new and delete to the language
Author: mmp
Created: 2011-12-15 18:50:52+00:00
State: open
Labels: features

We should add new and delete for C++-style dynamic memory allocation; new should have both uniform and varying variants:

```
float * uniform ptr = new float[10]; // one "uniform" allocation
float * ptr2 = varying new float[10]; // each active program instance does a separate allocation
delete[] ptr; // uniform delete
delete[] ptr2; // varying delete
```

We should probably allow delete[] as a synonym for delete, but not require it (since we don't have destructors).

These calls should call out to malloc() and free(), but there should also be a command-line switch to have them be calls to new ISPCMalloc() and ISPCFree() calls, so that apps can easily use their own allocators for these.