May the sone property abstract.  You are clearing it inside
finishLoad() which means, even with caching enabled, the song (and the
presumably Hibernate session that it was obtained from) is retained
needlessly between requests.

Most likely culprit is caching disabled, which leaks some memory
related to the series of Classes / ClassLoaders it builds.

On 2/22/07, Arjan Verstoep <[EMAIL PROTECTED]> wrote:
Hi,

I'm building an application with the Tapestry 4.0.2 framework, which
manages my music-collection. I'm getting OutOfMemoryErrors since I've
created a small ajax-ish component that refreshes every 10 seconds to
show the song that is currently playing. A piece of javascript gets the
Tapestry-page with the currently-playing song on it, and puts the
generated html into a <div>. After 24 hours or so making these
page-requests, an out of memory error occurs.

I have the feeling that this new auto-refreshing component of mine only
quickens the OutOfMemoryError, since I did get these errors before, but
only after much longer uptimes.

What am I doing wrong here? Is it the Spring OpenSessionInView-filter
that I use that is wasting memory, am I not cleaning-up everything
myself? Should I use Tapestry 4.1.1? Can anybody help? The code of the
page follows:
(You can also have a look at
http://musicontroller.cvs.sourceforge.net/musicontroller/ for more
sourcecode)

Thanks,
~Arjan Verstoep

public abstract class CurrentlyPlaying extends BasePage {
    public abstract SessionUserState getSessionUserState();
    public abstract Dao getDao();

    private Song _song = null;

    public Song getCurrentSong() {
        if (_song==null) {
            _song =
getDao().getSongById(getSessionUserState().getDJ().getCurrentSongId());
        }
        return _song;
    }

    public void finishLoad() {
        super.finishLoad();
        _song = null;
    }
}

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
<page-specification class="org.musicontroller.gui.dynamic.CurrentlyPlaying">
    <inject property="sessionUserState" type="state"
object="sessionUserState"/>
    <inject property="dao" object="spring:dao"/>

    <component id="ifPlaying" type="If">
        <binding name="condition" value="getCurrentSong()!=null"/>
    </component>

    <component id="songName" type="Insert">
        <binding name="value" value="ognl:currentSong.name"/>
    </component>

    <component id="band" type="components/BandLink">
        <binding name="band" value="ognl:currentSong.getBand()"/>
<!-- Why doesn't currentSong.band work?? -->
    </component>
</page-specification>

<body jwcid="@Body">
    <span jwcid="$content$">
        <span jwcid="ifPlaying">
            <span jwcid="band"/>&nbsp;-&nbsp;<span jwcid="songName"/>
        </span>
    </span>
</body>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to