I've always wondered if I'm using stackPush() and stackGet() correctly. Currently, if I have to use stack, I will first make something like:
try (var stack = MemoryStack.stackPush()) {
...
}
Then, if i'm calling a method within the try block, I will use stackGet() to avoid passing the stack in the parameters of the method:
try (var stack = MemoryStack.stackPush()) {
foo();
}
...
void foo() {
var stack = stackGet();
...
}
I don't find any real explanation about stackGet() on the javadoc, so am I correctly using this function? Does someone can explain me the difference between stackPush() and stackGet() if I'm wrong?