MCPcopy Create free account
hub / github.com/RenderKit/oidn / attach

Method attach

core/arena.cpp:43–61  ·  view source on GitHub ↗

Attaches a scratch arena and returns the heap that backs its memory

Source from the content-addressed store, hash-verified

41
42 // Attaches a scratch arena and returns the heap that backs its memory
43 Heap* ScratchArenaManager::attach(ScratchArena* arena)
44 {
45 Alloc& alloc = allocs[arena->name];
46
47 if (alloc.heap)
48 {
49 // Increase the size of the heap if necessary
50 if (arena->byteSize > alloc.heap->getByteSize())
51 alloc.heap->realloc(arena->byteSize);
52 }
53 else
54 {
55 // Allocate a new heap
56 alloc.heap = engine->newHeap(arena->byteSize, Storage::Device);
57 }
58
59 alloc.arenas.insert(arena);
60 return alloc.heap.get();
61 }
62
63 // Detaches the scratch arena
64 void ScratchArenaManager::detach(ScratchArena* arena)

Callers 1

ScratchArenaMethod · 0.45

Calls 4

reallocMethod · 0.80
newHeapMethod · 0.80
getByteSizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected