EventHopper / EHServerSide

Server-Side functionality including REST API, hosting scripts & client-server modules
0 stars 0 forks source link

Recursive getEventObjects gets all events on all pages #53

Closed kylermintah closed 4 years ago

kylermintah commented 4 years ago

Resolves #52

kylermintah commented 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).

image

masterford commented 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).

image

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.