Warning: session_start(): open(/var/lib/php/sessions/sess_l32ahs6bpgnoootrhia14p30ql, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
scope guessDeepObjectSize_debug.
sclass #Path {
O parentObject;
Field field;
Path parent;
*(O *parentObject, Field *field, Path *parent) {}
toString {
ret (parent == null ? "" : parent + " -> ") + field;
}
}
sclass OnStack {
O object;
Path path; // how we got to this object
*(O *object, Path *path) {}
}
sclass #Data {
long size;
new L stack;
Set seen = identityHashSet(); // add objects here to ignore them
Set fieldsToIgnore;
Set realmsToIgnore;
}
static long guessDeepObjectSize_debug(O o) {
if (o == null) ret 0;
ret guessDeepObjectSize_debug(new Data, o);
}
static long guessDeepObjectSize_debug(Data data, O o) {
if (o == null) ret 0;
data.stack.add(OnStack(o, null));
while ping (nempty(data.stack)) {
#step(data, popLast(data.stack));
}
ret data.size;
}
svoid #step(guessDeepObjectSize_recursive_Data data, OnStack os) {
O o = os.object;
if (!data.seen.add(o)) ret;
if (o instanceof Component) ret; // skipping AWT for now
if (o instanceof Thread) ret;
if (data.realmsToIgnore != null && contains(data.realmsToIgnore, getRealm(o))) ret;
if (o instanceof Class) ret;
if (isArray(o)) {
int len;
if (o instanceof O[]) {
len = unsafe_sizeOf(o);
for (O x : (O[]) o)
if (x != null && !data.seen.contains(x)) data.stack.add(x);
} else
len = inMemorySizeOfPrimitiveArray(o);
data.size += len;
ret;
}
data.size += unsafe_sizeOf(o);
if (o instanceof WeakReference) ret;
try {
for (Field f : nonStaticNonPrimitiveFieldObjects(o)) {
if (contains(data.fieldsToIgnore, f)) continue;
O x = f.get(o);
if (x != null && !data.seen.contains(x)) {
data.stack.add(OnStack(x, Path(o, f, os.path));
}
}
} catch e {
print("Error estimating object size: " + os.path + " - " + e);
}
//fail("can't handle object type: " + className(o));
}
end scope