Commit Graph

4 Commits

Author SHA1 Message Date
Sergey Sharybin
42fd1b9abe Cycles: Fix issues with stack allocator in MSVC
Couple of issues here:

- Was a bug in heap memory allocation when run out
  of allowed stack memory.

- Debug MSVC was failing because it uses separate
  allocator for some sort of internal proxy thing,
  which seems to be unable to be using stack memory
  because allocator is being created in non-persistent
  stack location.
2016-04-25 13:50:27 +02:00
Sergey Sharybin
e3544c9e28 Cycles: Throw bad_alloc exception when custom allocators failed to allocate memory
This mimics behavior of default allocators in STL and allows all the routines
to catch out-of-memory exceptions and hopefully recover from that situation/
2016-04-20 15:49:52 +02:00
Sergey Sharybin
be2186ad62 Cycles: Solve possible issues with running out of stack memory allocator
Policy here is a bit more complicated, if tree becomes too deep we're
forced to create a leaf node and size of that leaf wouldn't be so well
predicted, which means it's quite tricky to use single stack array for
that.

Made it more official feature that StackAllocator will fall-back to
heap when running out of stack memory.

It's still much better than always using heap allocator.
2016-04-04 14:13:19 +02:00
Sergey Sharybin
ffe59c54cb Cycles: Add STL allocator which uses stack memory
At this point we might want to rename allocator files to
util_allocator_foo.c so the stay nicely grouped in the folder.
2016-03-31 10:06:21 +02:00