Hi eric,
the removeOverlay() you are telling about, is the one from gwt? what
argument do you pass?I've tried having a vector of markers, each time
i put a new marker in... then, after clearOverlays, i've tried with
this:
Iterator v = labeledMarkerVector.iterator();
while(v.hasNext())
{
//250209Miki: rimuovo anche overlay singolarmente
map.removeOverlay((LabeledMarker)v.next());
}
//250209Miki: e poi svuoto vettore di appoggio
labeledMarkerVector.clear();
but with no luck.. I don't undestand what take the removeOverlay
method... and if it could solve the problem
Thx
Michela
On 25 Feb, 21:58, Eric Ayers <[email protected]> wrote:
> In my tests, an implementation that uses 'removeOverlay()' didn't seem
> to leak after running a long time (although it used more memory than
> the pool implementation)
>
> The clearOverlays() leak is independent of the GWT wrappers, so about
> the best I can say for getting the memory leak resolved is to go to
> the issue and 'star' the issue. You can post on the issue or on the
> Maps API list about why this is blocking for your application.
>
> Depending on how many icons you have, I think you could work around it
> by creating pools of markers by icon, and use some of the LabelMarker
> setters to reset the text labels. If there is some functionality you
> need, since you have the source to LabeledMarker, maybe there is some
> enhancement you could make to it to help add a way to set resources
> after the LabeledMarker is constructed.
>
> -Eric.
>
>
>
> On Wed, Feb 25, 2009 at 2:54 PM, koalina <[email protected]> wrote:
>
> > thx eric, the problem is that in gwt i have to instantiate a new
> > marker object every time i add a marker: in fact it's not possible to
> > update the "options", but they are defined only in the constructor.So,
> > how can i solve with this application?is there any patch for google
> > maps api for gwt?
> > thx,
>
> > Michela
>
> > On Feb 25, 6:24 pm, Eric Ayers <[email protected]> wrote:
> >> I've been able to reproduce a leak in pure JavaScript without any GWT.
> >> This issue is described in the Maps API issue tracker
>
> >>http://code.google.com/p/gmaps-api-issues/issues/detail?id=945
>
> >> I attached some sample JavaScript for creating a pool of markers
> >> instead of removing them from the map.
>
> >> -Eric.
>
> >> On Wed, Feb 25, 2009 at 9:48 AM, koalina <[email protected]> wrote:
>
> >> > hi all,
> >> > I've tried as suggested by jason with this semplified piece of code:
> >> > public class MainEntryPoint implements EntryPoint{
>
> >> > private Marker marker;
> >> > private MapWidget map;
>
> >> > public MainEntryPoint() {
> >> > }
>
> >> > /**
> >> > * The entry point method, called automatically by loading a
> >> > module
> >> > * that declares an implementing class as an entry-point
> >> > */
> >> > public void onModuleLoad() {
>
> >> > map = new MapWidget(LatLng.newInstance(38.1890087,
> >> > 15.5648162), 12);
>
> >> > map.checkResizeAndCenter();
> >> > RootPanel.get().add(map);
> >> > Timer t = new Timer(){
> >> > �...@override
> >> > public void run() {
> >> > for (int i = 0; i < 10; i++)
> >> > {
> >> > map.clearOverlays();
> >> > map.addOverlay(createMarker());
> >> > }
> >> > }
> >> > };
> >> > t.scheduleRepeating(3000);
>
> >> > //180209Miki:per prima cosa devo caricare le api
> >> > *dinamicamente*
> >> > //...poi tutto il resto di conseguenza
>
> >> > //lookupKey(Window.Location.getHost());
>
> >> > }
> >> > public Marker createMarker()
> >> > {
> >> > marker = null;
> >> > marker = new Marker(LatLng.newInstance(new Double(15), new
> >> > Double(38)));
> >> > return marker;
>
> >> > }
> >> > }
>
> >> > I would expect memory doesn't increase.. it doesn't
> >> > clearOverlays does not remove references with ie7
> >> > any workaround...?
> >> > please help, thx,
> >> > Michela
>
> >> > On 24 Feb, 20:22, koalina <[email protected]> wrote:
> >> >> commenting the addOverlay, memory usage is costant...
> >> >> that's why i think there's something wrong with the clearOverlays..
> >> >> thx for help,
> >> >> michela
>
> >> >> On Feb 24, 5:47 pm, Eric Ayers <[email protected]> wrote:
>
> >> >> > Yeah, you are right.
>
> >> >> > One thing you could try is to comment out the 'addOverlay()' call and
> >> >> > measure your memory again. You won't see anything, but it will tell
> >> >> > you if this is the problem.
>
> >> >> > On Tue, Feb 24, 2009 at 11:39 AM, koalina <[email protected]> wrote:
>
> >> >> > > but i call the clerOverlays each time i run the timer.. at each loop
> >> >> > > the markers should be deallocated... aren't they?
> >> >> > > Michela
>
> >> >> > > On 24 Feb, 17:31, Eric Ayers <[email protected]> wrote:
> >> >> > >> 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);
>
> >> ...
>
> >> read more »
>
> --
> Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://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
-~----------~----~----~----~------~----~------~--~---