Think about what your code is doing here.

You are allocating marker objects and adding them to the map every
time your timer expires.
The map will track these things for you until you call map.removeOverlay().

My guess is that you have hundreds of markers added to the map, all
stacked on top of each other.

http://gwt-google-apis.googlecode.com/svn/javadoc/maps/1.0/index.html


On Tue, Feb 24, 2009 at 6:57 AM, koalina <[email protected]> wrote:
>
> Hi all, I've found the cause of the memory leak isolating by some
> piece of code. It seems not to be caused by gwt-ext but when I make
> the map.addOverlay(createMarker(point,  myObject));
>
> where createMarker is:
>
> Icon icon = Icon.newInstance(baseIcon);
>
>
>        icon.setImageURL(GWT.getModuleBaseURL()+"images/"+getColor
> (nave)+"_ship.png");
>
>        GWT.log("Carico immagine "+icon.getImageURL(), null);
>        LabeledMarkerOptions options = LabeledMarkerOptions.newInstance
> ();
>        options.setTitle(nave.getNomeNave());
>        options.setIcon(icon);
>
>        options.setLabelText(String.valueOf(nave.getIdNave()));
>
>        options.setLabelClass("labeledMarker");
>
>        //200209Miki: se l'id nave è lungo una solo cifra va bene
> così...
>        if((Integer.toString(nave.getIdNave())).length()==1)
>            options.setLabelOffset(Size.newInstance(1, -26));
>        //altrimenti devo shiftare la label di due posti a sinistra...
>        else
>            options.setLabelOffset(Size.newInstance(-2, -26));
> //
>
>
>
>
>
>        LabeledMarker marker = new LabeledMarker(point, options);
>
>
>        ((Marker)marker).addMarkerClickHandler(new MarkerClickHandler
> () {
>
>            public void onClick(MarkerClickEvent event) {
>                //050209Miki: gestisco qui il popup informativo
>                InfoWindow info = map.getInfoWindow();
>                info.open(event.getSender(),
>
>
>                new InfoWindowContent(
>                "<div style='width:150px;height:65px; font-size:12px'
> " +
>                "class='info-window'>" +
>                //"<p><img width='35px' src='"+GWT.getModuleBaseURL()
> +"'images/logonave.png' align='left'></p>" +
>                "Nome nave: <b>"+nave.getNomeNave()+"</b><br/>" +
>                "Localita' Partenza: " +nave.getLocalitaPartenza()
> +"<br/>" +
>                "Localita' Arrivo: "+nave.getLocalitaPartenza()+"<br/
>>" //+
>                //"Merci Pericolose a Bordo: " +
> nave.getMerciPericolose()+"<br/></div>"
>                ));
>
>            }
>
>        });
>
>        return marker;
>
> It' squite strange but now I'm sure the issue is with this piece of
> code..
> is     map.clearOverlays(); sufficient to deallocate the previous
> markers?
> thx,
> Michela
>
> On 24 Feb, 10:56, Alexey_Tsiunchik <[email protected]> wrote:
>> Hello,
>>
>> We already have discussion about GWT memory management 
>> here:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>>
>> Tuesday, February 24, 2009, 11:31:44 AM, you wrote:
>>
>>
>>
>> > I've tried reloading, I made a mistake some posts ago.. memory
>> > decreases only if the browser is closed and then opened again. Only
>> > reloading causes a bigger increment of memory usage.
>> > On 24 Feb, 10:20, koalina <[email protected]> wrote:
>> >> Hi alex,
>> >> sorry but I can't see how fix the number of rows as I'm using a
>> >> memoryProxy object.
>> >> So, the timer is defined as follows:
>> >> Timer t = new Timer() {
>>
>> >>             public void run() {
>> >>                 getShipInfo();
>>
>> >>             }
>>
>> >>         };
>> >>  where getShipInfo() is
>>
>> >> private void getShipInfo() {
>>
>> >>         MainEntryPoint.getServiceWsNaviInMare().getInfoNaviInMare(new
>> >> AsyncCallback() {
>>
>> >>             public void onFailure(Throwable caught) {
>> >>                 throw new UnsupportedOperationException("Not supported
>> >> yet.");
>> >>             }
>>
>> >>             public void onSuccess(Object result) {
>> >>                 Vector listaNavi = (Vector) result;
>> >>                 GWT.log("Lista Navi Ricevuta: "+listaNavi.toString(),
>> >> null);
>> >>                 if (listaNavi.size()>0) {
>>
>> >>                     Object[][] data = new Object[listaNavi.size()]
>> >> [15];
>> >>                     Iterator i = listaNavi.iterator();
>> >>                     int index = 0;
>>
>> >>                     while (i.hasNext()) {
>> >>                         Nave unaNave = (Nave) i.next();
>> >>                         data[index] = new Object[]{
>> >>                             unaNave.getIdNave(), unaNave.getNomeNave
>> >> (),
>>
>> >>                             unaNave.getLocalita(), unaNave.getImbarco
>> >> (),
>>
>> >>                             etc....
>>
>> >>                         GWT.log("Nave "+data[index][0]+data[index]
>> >> [1].toString(), null);
>>
>> >>                         index++;
>> >>                         unaNave =  null;
>>
>> >>                     }
>> >>                     if (store!=null) {
>> >>                         store.removeAll();
>> >>                     }
>> >>                     MemoryProxy proxy = new MemoryProxy(data);
>> >>                     ArrayReader reader = new ArrayReader(recordDef);
>> >>                     store = new Store(proxy, reader);
>> >>                     store.load();
>> >>                     store.commitChanges();
>>
>> >>                     grid.reconfigure(store, columnModel);
>> >>                     //240209Miki: x diminuire memory leak ...
>> >>                     grid.clear();
>> >>                     data = null;
>> >>                     proxy = null;
>> >>                     reader =null;
>> >>                     store = null;
>>
>> >>                 }
>> >>             }
>>
>> >>         });
>>
>> >> }
>>
>> >> I've tried with FF and there's no problem...so it's an issue with ie7.
>> >> Can you see some big error in the code i posted just above? thx for
>> >> help!
>> >> Michela
>>
>> >> On 24 Feb, 09:48, "alex.d" <[email protected]> wrote:
>>
>> >> > Assuming adding/removing markers to/from the map is leakless (google
>> >> > probably knows how to do this ;-) we are left with gwt-ext grid. Every
>> >> > 10 sec you remove old rows and add new ones. So you have some DOM-
>> >> > Elements (a table row) that are removed/created every 10 seconds.
>> >> > Probably it's a grid's particular implementation that leaks. But most
>> >> > probably it's just IE that doesn't really remove garbage properly even
>> >> > when it can/should. So what can you do?
>> >> > 1. If it's grid that leaks: dump it - implement smth. yourself with
>> >> > vanilla GWT.
>> >> > 2. It it's IE: let's say the total ammount of markers is never bigger
>> >> > than 25 - you can create 25 rows in the table and instead of adding/
>> >> > removing them you just change the text. This way you'll have slightly
>> >> > more memory allocated at the beginning but hopefully no leaks while
>> >> > running because no DOM-Elements are created/removed.
>>
>> >> > hth
>>
>> >> > On 24 Feb., 09:14, koalina <[email protected]> wrote:
>>
>> >> > > Hi Jason, yes, reloading page cause memory usage fall out.
>> >> > > My app is quite simple: a gwt ext tab panel, the first tab showing the
>> >> > > map widget, the second one a gwt ext grid with a few rows (more or
>> >> > > less 10), each one with some information about the markers showed.
>> >> > > I've three "thread", implemented as Timer, which refresh positions of
>> >> > > markers, informations and last update time. Each thread make a rpc
>> >> > > call and is always running, even when the tab of interest is not
>> >> > > active....
>> >> > > Do you see some critical issue in this application?
>> >> > > thx for help, have a nice day
>> >> > > Michela
>>
>> >> > > On 23 Feb, 20:55, Jason Essington <[email protected]> wrote:
>>
>> >> > > > Well, I've read various articles claiming that IE leaks like a sieve
>> >> > > > (don't have any references for you right now, but I'm sure google
>> >> > > > could help).
>>
>> >> > > > One thing to try is does IE's memory usage come down when you reload
>> >> > > > the page, or load a new page?
>>
>> >> > > > -jason
>>
>> >> > > > On Feb 23, 2009, at 8:44 AM, koalina wrote:
>>
>> >> > > > > is there anyone who knows about memory leaks in this case?I've a
>> >> > > > > tabPanel, but tab are not dinamically added, a MapWidget, 
>> >> > > > > periodically
>> >> > > > > rpc to refresh marker on map
>> >> > > > > I'm really getting crazy!
>> >> > > > > thx,
>> >> > > > > Michela
>>
>> >> > > > > On 23 Feb, 14:37, koalina <[email protected]> wrote:
>> >> > > > >> I'm using google maps api for gwt, no memory leak found
>> >> > > > >> gwt-ext, some leaks found, but it seems not to be my case...
>>
>> >> > > > >> please note that with JScript leaks detect there's no leak 
>> >> > > > >> found...
>> >> > > > >> could it be a problem with ajaxLoader?or perhaps something coming
>> >> > > > >> from
>> >> > > > >> timer.scheduleRepeating with rpc inside run body?
>> >> > > > >> Michela
>>
>> >> > > > >> On 23 Feb, 14:29, Mahavir Jain <[email protected]> wrote:
>>
>> >> > > > >>> You should try googling out for memory-leaks for the packages 
>> >> > > > >>> you
>> >> > > > >>> are
>> >> > > > >>> using..
>>
>> >> > > > >>> For eg:- If you are using Image bundles then try googling the
>> >> > > > >>> memory leaks
>> >> > > > >>> related to image bundles..
>>
>> >> > > > >>> Hope this will help.
>>
>> >> > > > >>> Thanks.
>> >> > > > >>> Mahavir
>>
>> >> > > > >>> On Mon, Feb 23, 2009 at 6:49 PM, koalina <[email protected]>
>> >> > > > >>> wrote:
>>
>> >> > > > >>>> it is present web mode running on dedicated tomcat (I don't 
>> >> > > > >>>> know
>> >> > > > >>>> for
>> >> > > > >>>> hosted mode..).
>> >> > > > >>>> iexplorer.exe process exponential grows..
>>
>> >> > > > >>>> On 23 Feb, 13:03, Eric Ayers <[email protected]> wrote:
>> >> > > > >>>>> Is this a problem in web mode, hosted mode, or both?
>>
>> >> > > > >>>>> On Mon, Feb 23, 2009 at 7:01 AM, koalina <[email protected]>
>> >> > > > >>>>> wrote:
>>
>> >> > > > >>>>>> hi Mahavir ,
>> >> > > > >>>>>> thx for your reply.
>> >> > > > >>>>>> I'm working with gwt 1.5.3 and ie7, is this issue valid also 
>> >> > > > >>>>>> in
>> >> > > > >>>>>> this
>> >> > > > >>>>>> case?
>> >> > > > >>>>>> thx,
>> >> > > > >>>>>> Michela
>>
>> >> > > > >>>>>> On 23 Feb, 12:57, Mahavir Jain <[email protected]> wrote:
>> >> > > > >>>>>>> I am not sure whether this applies to you or not but there 
>> >> > > > >>>>>>> is
>> >> > > > >>>>>>> memory
>> >> > > > >>>> leak
>> >> > > > >>>>>>> issue in IE6 browser for all RPC call.. You can check the 
>> >> > > > >>>>>>> issue
>> >> > > > >>>> onhttp://code.google.com/p/google-web-toolkit/issues/detail?
>> >> > > > >>>> id=1610..
>>
>> >> > > > >>>>>>> But this is not case for firefox.. Did you tried on firefox?
>>
>> >> > > > >>>>>>> Mahavir
>>
>> >> > > > >>>>>>> On Mon, Feb 23, 2009 at 5:13 PM, koalina 
>> >> > > > >>>>>>> <[email protected]>
>> >> > > > >>>>>>> wrote:
>>
>> >> > > > >>>>>>>> Hi all,
>> >> > > > >>>>>>>> I've developed a gwt app using MapWidget. The markers 
>> >> > > > >>>>>>>> showed
>> >> > > > >>>>>>>> on the
>> >> > > > >>>>>>>> map are periodically refreshed via rpc calls. The refresh 
>> >> > > > >>>>>>>> time
>> >> > > > >>>> period
>> >> > > > >>>>>>>> is 10 seconds. The app correctly runs for about an hour, 
>> >> > > > >>>>>>>> then
>> >> > > > >>>>>>>> the
>> >> > > > >>>>>>>> memory used increase exponentially... I've installed the js
>> >> > > > >>>>>>>> leaks
>> >> > > > >>>>>>>> inspector for ie7, but no leak is catched... What can i do 
>> >> > > > >>>>>>>> to
>> >> > > > >>>> resolve
>> >> > > > >>>>>>>> this problem? I've reviewed all code..but everything seems 
>> >> > > > >>>>>>>> to
>> >> > > > >>>>>>>> be
>> >> > > > >>>>>>>> correct...
>> >> > > > >>>>>>>> Thx for helping, have a nice day,
>> >> > > > >>>>>>>> Michela
>>
>> >> > > > >>>>> --
>> >> > > > >>>>> Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://
>> >> > > > >>>> code.google.com/webtoolkit/
>>
>> --
>> Best regards,
>>  Alexey_Tsiunchik                            
>> mailto:[email protected]
> >
>



-- 
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to