Java - I keep losing references to my Global class -
so have global class supposed hold sorts of info can accessed of files. global looks this:
public class global{ public static int rules = 0; public static string data; public static int score; public static int speed = 0; //etc... } i set , things doing global.x = ___ , such.
however, cleaned memory leak in project, view (view a) created lived longer supposed to.
this view a assigned global.x.
now, 1 time move view b, view a gc'd.
however, global.x no longer has value.
is expected behavior java? if so, how can assign variable global class view a , assure kept after view a dies.
or doing wrong somewhere else?
i figured i'd inquire in case i'm overlooking something, it's latter.
design issues aside;
there 2 ways can think of create garbage collection of view a have effect on value of global.x;
global.x (or uses) weakreference view a or garbage collected along it. view a has finalizer changes value of global.x. neither of these sound (although, of course of study can't see code)
my best bet should elsewhere error. since global state variables inherently not thread safe in way, problem may threading related.
java global
No comments:
Post a Comment