Closed kylermintah closed 4 years ago
Recursion doesn't affect heap space, affects stack space :) Please see comments on whether the events returned is ever null.
Recursion affects both stack and heap space. Not all recursion is heap-safe especially when object creation is involved like here. Heap space is responsible for object storage which is why running this on my device exhausts the heap space eventually (the consideration we'd make is how much to allocate when we host). We are creating a lot of objects (and also printing them to the console as well).
Recursion doesn't affect heap space, affects stack space :) Please see comments on whether the events returned is ever null.
Recursion affects both stack and heap space. Not all recursion is heap-safe especially when object creation is involved like here. Heap space is responsible for object storage which is why running this on my device exhausts the heap space eventually (the consideration we'd make is how much to allocate when we host). We are creating a lot of objects (and also printing them to the console as well).
Right but technically it's not the recursion per se that's causing the heap memory issue. Recursion affects stack space. The heap issue will happen regardless of recursion when you create too many objects in memory.
Resolves #52