Well obviously :-)
I thought it was suppose to be cleaned up automatically by the framework.
How else would it be possible if we pass the model Map reference to a
Controller (encapsulating it in the ModelAndView instance) and then it gets
passed to a View.render() method. I feel that the life time of the model Map
should end in the View.render() Anybody correct me if I am wrong.
Thanks,
Dmitriy.
-----Original Message-----
From: William G. Thompson, Jr. [mailto:wgthom@...]
Sent: Thursday, March 27, 2003 16:03 PM
To: Kopylenko, Dmitry
Subject: Re: [Springframework-developer] Help!!!
You have a memory leak! :) lol
Who cleans up the the model?
Kopylenko, Dmitry wrote:
> Hello everybody. I have a big problem and if anybody could help I would
> definitely appreciate it.
>
> In the nutshel, I have a MultiActionController with one of the request
> handling methods which does retrieve three lists of "reference data" from
> ApplicationContext (I load the reference data at the bootstrap, similarly
to
> CachingCalendar in the BoxOffice application) and puts the "lists" in the
> model Map to make it available to a View:
>
> public ModelAndView processProgramInquiryAdd(HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException {
>
> Map model = new HashMap();
> model.put("programLookup", ((GradApplicationReferenceData)
> getApplicationContext().getBean
>
> ("gradApplicationReferenceData")).getPrograms());
> model.put("stateLookup", ((GradApplicationReferenceData)
> getApplicationContext().getBean
>
> ("gradApplicationReferenceData")).getStates());
> model.put("countryLookup", ((GradApplicationReferenceData)
> getApplicationContext().getBean
>
> ("gradApplicationReferenceData")).getCountries());
>
> // Rest of the processing
> .........................
> return new ModelAndView(ESTABLISH_NEW_PROGRAM_INQUIRY_VIEW,
> model);
> }
>
> My dev. environment is NT4 with around 300M of RAM, Sun's JDK 1.4 and
JBoss
> 3.0.4
> When I run this request handling method several times (e.g. hit the submit
> button on the web page), after about the third time the JVM dies with:
>
> Exception in thread "CompileThread0" java.lang.OutOfMemoryError: requested
> 32756 bytes
>
> When I comment out the block of code which puts the "reference lists" into
a
> model Map, it runs fine.
> Could anybody, please tell me if the code is ok and it does not create a
> problem. And what could it be?
>
> Thanks,
>
> Dmitriy.
|