Hello Shawn,

Are references kept for all of the `Timer.Context` objects over the
lifetime of the program? If so, then they should behave as any other
objects instantiated by application code, meaning they won't be garbage
collected until they become unreachable.

On Thu, Jun 1, 2017 at 10:49 AM, Shawn Heisey <[email protected]> wrote:

> I'm trying to compile some statistics on code I've written that does image
> conversions in a batch.  The idea is that each time it encounters an image
> to convert, it will create some contexts for Timer objects:
>
>   final Timer.Context allContext = allTimer.time();
>   final Timer.Context errContext = errTimer.time();
>   final Timer.Context genContext = genTimer.time();
>
> What I need to know is whether the context objects will cause a memory
> leak if they are never stopped... because for any given image, allContext
> will always be stopped, but only one of genContext or errContext will be
> stopped.  I don't want to update the error timer when the generation is
> successful, or the generation timer when it's not successful.  I looked for
> a way to delete a context object on both Context and Timer, but didn't find
> anything, so my hope is that the objects will simply become garbage when
> they're no longer referenced by my program.
>
> Tried to find whether anyone had asked a question like this, wasn't able
> to locate anything.
>
> --
> You received this message because you are subscribed to the Google Groups
> "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Evan Meagher <https://evanmeagher.net/>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to