You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ChambreNoire <aw...@tentelemed.com> on 2015/01/04 22:24:30 UTC

DebugBar reports strange sizes

Hello,

I’m playing around, trying to make sense of the DebugBar Inspector, in
particular the sizes reported.

I have a page with two Labels. I have artificially boosted their sizes with
a large instance variable. One is 1M the other 0,5M. In the inspector each
is reported as 1,5M. 

Any ideas why this is?

Many Thanks,

CN

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DebugBar-reports-strange-sizes-tp4668920.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: DebugBar reports strange sizes

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Mon, Jan 5, 2015 at 3:10 PM, ChambreNoire <aw...@tentelemed.com> wrote:

> I'm having trouble fully understanding Wicket's serialization.
>

It is not Wicket serialization. It is Java serialization.


>
> I understand that if I declare a final object outside of an anonymous inner
> class and then use it from within that anonymous inner class, the compiler
> will ass a member variable to the anonymous inner class which gets
> serialized.
>

Actually the inner class has a reference to the complete outer/normal class.


>
> final Object outer = /a 10K entity/;
>
> add(new Label("label", new LoadableDetachableModel() {
>
>     @Override
>     protected Object load() {
>         return outer;
>     }
> }));
>
> However if the containing component / page has a large Model
>
> setDefaultModel(Model.of(/a 50K entity/));
>
> DebugBar Inspector reports that the Label takes up 66.5K (including the
> 6.1K
> debugbar).
>
> Does this mean that all anonymous inner classes, declared within a
> component
> with such a model, will serialize a copy of the container? This seems to be
>

Yes and No.
Java serialization will serialize the referred container *once*. All inner
classes will serialize just a pointer to the container.


> what the sizes reported by the DebugBar suggests...
>
> (I'm aware of the correct usage of LDMs etc. I'd just like to understand
> the
> consequences of the various anti-patterns)
>

Calculating the size of an object in Java is very tricky. It is a best
effort, not exact.


>
> Thanks,
>
> CN
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/DebugBar-reports-strange-sizes-tp4668920p4668926.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: DebugBar reports strange sizes

Posted by ChambreNoire <aw...@tentelemed.com>.
I'm having trouble fully understanding Wicket's serialization. 

I understand that if I declare a final object outside of an anonymous inner
class and then use it from within that anonymous inner class, the compiler
will ass a member variable to the anonymous inner class which gets
serialized.

final Object outer = /a 10K entity/;

add(new Label("label", new LoadableDetachableModel() {

    @Override
    protected Object load() {
        return outer;
    }
}));

However if the containing component / page has a large Model 

setDefaultModel(Model.of(/a 50K entity/));

DebugBar Inspector reports that the Label takes up 66.5K (including the 6.1K
debugbar).

Does this mean that all anonymous inner classes, declared within a component
with such a model, will serialize a copy of the container? This seems to be
what the sizes reported by the DebugBar suggests...

(I'm aware of the correct usage of LDMs etc. I'd just like to understand the
consequences of the various anti-patterns)

Thanks,

CN



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DebugBar-reports-strange-sizes-tp4668920p4668926.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org