correction i meant not much memory will be eaten in mounting and maintaining that map..
On Wed, Dec 7, 2011 at 4:08 PM, vineet semwal <[email protected]> wrote: > i agree with martin.. > wicket only maintains concurrenthashpmap of key(ResourceRefrence.Key) > and value (ResourceRefrence) > both are very small objects so not much memory will be eaten in mounting as > such > > > your problem might lie in generating the resources.. > > On Wed, Dec 7, 2011 at 3:51 PM, John Toncart <[email protected]> wrote: >> Try put 20 images on page and display the page 1.000 times. If each >> image is 1MB in size I'm sure StackOverflow error will be raised. I have >> tested with memory set to 1GB in Tomcat and was produced. Profiling >> shows that problem lies in mounted images. Dismounting them after they >> have been shown on page resolved problem and Webapp runs with just >> around 300-400MB memory comsumption. >> >> >> >> Martin Grigorov wrote: >>> >>> On Wed, Dec 7, 2011 at 11:04 AM, John Toncart <[email protected]> >>> wrote: >>>> >>>> Dismounting: imagine webapp whith thousands generated images. from time >>>> to >>>> time >>>> each image is mounted (and displayed). If then wasn't dismounted, memory >>>> will be >>>> eated and stackoverflow error will be produced. >>> >>> >>> I don't see how StackOverflowError may happen. >>> >>> The problems I see are more memory consumption and longer time to >>> iterate over the mappings and find the one that matches. >>> >>>> >>>> >>>> vineet semwal wrote: >>>>> >>>>> can i ask why are you dismounting? >>>>> >>>>> create your resourcereference that returns your resource,use >>>>> resourcereference for mounting >>>>> >>>>> and Key key =new Key(your ResourceReference) >>>>> >>>>> you should also read a very nice martin-g's article on how to mount >>>>> resources in wicket 1.5 >>>>> >>>>> >>>>> http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/comment-page-1/ >>>>> >>>>> On Wed, Dec 7, 2011 at 12:28 PM, John Toncart <[email protected]> >>>>> wrote: >>>>>> >>>>>> Hi folks, >>>>>> >>>>>> in 1.4 I was doing (pseudo code, real code is longer): >>>>>> >>>>>> public class MyPage extends WebPage >>>>>> { >>>>>> public MyPage() >>>>>> { >>>>>> ... >>>>>> DynamicImageResource image = new DynamicImageResource(); >>>>>> image.setImageData(_my_generated_byte_array_); >>>>>> ... >>>>>> MyApp.get().getSharedResources().remove("/my/custom/resource.jpg"); >>>>>> MyApp.get().getSharedResources().add("/my/custom/resource_new", >>>>>> image); >>>>>> ... >>>>>> } >>>>>> } >>>>>> >>>>>> Not know if it's optimal but it works and resources are dynamicaly >>>>>> mounted and dismounted. >>>>>> >>>>>> In 1.5 I can't do: >>>>>> MyApp.get().getSharedResources().remove("/my/custom/resource.jpg"); >>>>>> because remove() method in 1.5 needs "ResourceReference.Key" >>>>>> >>>>>> Is there example how to work with remove() in 1.5 or how to rewrite >>>>>> my code in example above? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> JT >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>> >>>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>> >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > > -- > thank you, > > regards, > Vineet Semwal -- thank you, regards, Vineet Semwal --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
