IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

API standards et tierces Android Discussion :

Out of Memorysur un des appels web services Restlet


Sujet :

API standards et tierces Android

  1. #1
    Membre du Club
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Mai 2011
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Chef de projet en SSII
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2011
    Messages : 52
    Points : 60
    Points
    60
    Par défaut Out of Memorysur un des appels web services Restlet
    bonjour,

    J'ai une activité qui fais des relèvements de coordonnées (Lat,Long) et les envoies vers un serveur App Engine.

    je passe par AsyncTask pour l'appel au webservice. Celui-ci fait appel à deux méthodes du service PutCoordonne et GetCoordonne

    Car je passe les coordonnées du téléphone local et je récupère les coordonnées tu téléphones distant (Tracking).


    cela marche 3 fois et puis je tombe sur l'erreur OutOfMemoryerror

    voici la log
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    04-27 10:57:18.332: I/dalvikvm-heap(4940): Clamp target GC heap from 64.368MB to 64.000MB
    04-27 10:57:18.332: D/dalvikvm(4940): GC_FOR_ALLOC freed 317K, 5% free 62687K/65536K, paused 73ms, total 73ms
    04-27 10:57:18.332: I/dalvikvm-heap(4940): Forcing collection of SoftReferences for 32784-byte allocation
    04-27 10:57:18.397: I/dalvikvm-heap(4940): Clamp target GC heap from 64.267MB to 64.000MB
    04-27 10:57:18.397: D/dalvikvm(4940): GC_BEFORE_OOM freed 165K, 5% free 62521K/65536K, paused 62ms, total 62ms
    04-27 10:57:18.397: E/dalvikvm-heap(4940): Out of memory on a 32784-byte allocation.
    04-27 10:57:18.397: I/dalvikvm(4940): "Restlet-1119087168" daemon prio=5 tid=43 RUNNABLE
    04-27 10:57:18.397: I/dalvikvm(4940):   | group="main" sCount=0 dsCount=0 obj=0x42b3ea40 self=0x5c79a558
    04-27 10:57:18.397: I/dalvikvm(4940):   | sysTid=6742 nice=0 sched=0/0 cgrp=apps handle=1493912640
    04-27 10:57:18.397: I/dalvikvm(4940):   | state=R schedstat=( 149825543 3450876 19 ) utm=14 stm=0 core=2
    04-27 10:57:18.402: I/dalvikvm(4940):   at java.nio.ByteBuffer.allocate(ByteBuffer.java:~56)
    04-27 10:57:18.407: I/dalvikvm(4940):   at org.restlet.engine.io.Buffer.createByteBuffer(Buffer.java:67)
    04-27 10:57:18.407: I/dalvikvm(4940):   at org.restlet.engine.io.Buffer.<init>(Buffer.java:128)
    04-27 10:57:18.412: I/dalvikvm(4940):   at org.restlet.engine.connector.Way.<init>(Way.java:100)
    04-27 10:57:18.412: I/dalvikvm(4940):   at org.restlet.engine.connector.OutboundWay.<init>(OutboundWay.java:108)
    04-27 10:57:18.412: I/dalvikvm(4940):   at org.restlet.engine.connector.ClientOutboundWay.<init>(ClientOutboundWay.java:62)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.HttpClientOutboundWay.<init>(HttpClientOutboundWay.java:63)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.HttpClientHelper.createOutboundWay(HttpClientHelper.java:66)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.Connection.<init>(Connection.java:131)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.ClientConnectionHelper.createConnection(ClientConnectionHelper.java:143)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.ConnectionPool.createObject(ConnectionPool.java:76)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.ConnectionPool.createObject(ConnectionPool.java:47)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.util.Pool.preCreate(Pool.java:151)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.ConnectionPool.<init>(ConnectionPool.java:63)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.ConnectionHelper.createConnectionPool(ConnectionHelper.java:196)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.ConnectionController.doInit(ConnectionController.java:143)
    04-27 10:57:18.417: I/dalvikvm(4940):   at org.restlet.engine.connector.Controller.run(Controller.java:132)
    04-27 10:57:18.417: I/dalvikvm(4940):   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
    04-27 10:57:18.417: I/dalvikvm(4940):   at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    04-27 10:57:18.417: I/dalvikvm(4940):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    04-27 10:57:18.417: I/dalvikvm(4940):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    04-27 10:57:18.417: I/dalvikvm(4940):   at java.lang.Thread.run(Thread.java:841)
    04-27 10:57:18.432: W/System.err(4940): 27 avr. 2014 10:57:18 org.restlet.engine.connector.Controller run
    04-27 10:57:18.432: W/System.err(4940): WARNING: Unexpected error while controlling connector
    04-27 10:57:18.432: W/System.err(4940): Throwable occurred: java.lang.OutOfMemoryError
    04-27 10:57:18.432: W/System.err(4940): 	at java.nio.ByteBuffer.allocate(ByteBuffer.java:56)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.io.Buffer.createByteBuffer(Buffer.java:67)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.io.Buffer.<init>(Buffer.java:128)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.Way.<init>(Way.java:100)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.OutboundWay.<init>(OutboundWay.java:108)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ClientOutboundWay.<init>(ClientOutboundWay.java:62)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.HttpClientOutboundWay.<init>(HttpClientOutboundWay.java:63)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.HttpClientHelper.createOutboundWay(HttpClientHelper.java:66)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.Connection.<init>(Connection.java:131)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ClientConnectionHelper.createConnection(ClientConnectionHelper.java:143)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ConnectionPool.createObject(ConnectionPool.java:76)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ConnectionPool.createObject(ConnectionPool.java:47)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.util.Pool.preCreate(Pool.java:151)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ConnectionPool.<init>(ConnectionPool.java:63)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ConnectionHelper.createConnectionPool(ConnectionHelper.java:196)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.ConnectionController.doInit(ConnectionController.java:143)
    04-27 10:57:18.432: W/System.err(4940): 	at org.restlet.engine.connector.Controller.run(Controller.java:132)
    04-27 10:57:18.432: W/System.err(4940): 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
    04-27 10:57:18.432: W/System.err(4940): 	at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    04-27 10:57:18.432: W/System.err(4940): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    04-27 10:57:18.432: W/System.err(4940): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    04-27 10:57:18.432: W/System.err(4940): 	at java.lang.Thread.run(Thread.java:841)

    et voici mon code je ne comprend pas. J'ai pourtant placé mon appel web service en arrière plan ??

    L'appel au web service.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
     
    .......
    @Override
    	public void onLocationChanged(Location location) {
    		LatOrigin = location.getLatitude();
    		LngOrigin = location.getLongitude();
     
    		mapView.clear();
    		//	mapView.addMarker(new MarkerOptions().title("Vous êtes ici").position(new LatLng(LatOrigin, LngOrigin)));
    		if (LatDest > 0)
    		{
     
    			new DessineTrajet(InterMediationChercheSaPlace.this, LatOrigin,LngOrigin,LatDest, LngDest);
    		}
     
     
    		CompteurDeGeo++;	// tout les 5 relèvements je sauvegarde les coordonnées	
     
    		if (CompteurDeGeo > 5){
    			immatriculation = new immatriculation(
    					MatriculePartant, 
    					MatriculeArrivant, 
    					LatOrigin, 
    					LngOrigin,
    					Commande,
    					true,
    					Ladate.DateToString(Ladate.dateDuJour()));
    			new SauveGardeCoordonne(InterMediationChercheSaPlace.this, immatriculation);
    			CompteurDeGeo=0;
    		}
     
    	}
    .......
    le WebService

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    public class SauveGardeCoordonne {
    	private WeakReference<InterMediationChercheSaPlace> mActivity = null;
    	// Progression du téléchargement
    	
    	private immatriculation IMMAT;
    	private  ContainerCoord ListeCoordDistant;
    
    	public SauveGardeCoordonne (InterMediationChercheSaPlace pActivity,immatriculation Immat) {
    		
    		//Coordest= new LatLng(lat, lng);
    		link(pActivity);
    		IMMAT=Immat;
    		Rt mProgress = new Rt();
    		// On l'exécute
    		mProgress.execute(Immat);
    	}
    	
    	
    	public void link (InterMediationChercheSaPlacepActivity) 
    	{
    		mActivity = new WeakReference<InterMediationChercheSaPlace>(pActivity); 
    
    	}
    
    
    	class Rt extends AsyncTask<immatriculation,Integer, Boolean>
    	{
    		@Override
    		protected void onPostExecute (Boolean result) {
    			
    			if (mActivity.get() != null) {
    				if(result)
    				{
    					mActivity.get().ParamBd.Update_ImmatriculationStatus();
    					
    					immatriculation immatriculation= new immatriculation(
    							IMMAT.getImmatRecherche(),
    							IMMAT.getImmatriculation(), 
    							ListeCoordDistant.getCoordonne_list().get(0).getLatitude(),
    							ListeCoordDistant.getCoordonne_list().get(0).getLongitude(),				
    							IMMAT.getCommande(),true, 
    							ListeCoordDistant.getCoordonne_list().get(0).getDateHeure() 
    							);
    					// enregistre en Base de données 
    					mActivity.get().ParamBd.Insert_immatriculation(immatriculation);
    				}
    				
    			}
    		}
    
    
    
    		protected Boolean doInBackground (immatriculation... Location) 
    		{
                              //Appel au web Service
    			ImmatriculationController uController=new ImmatriculationController();
    
    			
    				try { 
    					// place les coordonnée du local par rapport au distant
    					 long Result = uController.PutCoordonnee(Location[0]);
    					
                                              // récupére les coordonnées encours du distant
                                              ListeCoordDistant = new ContainerCoord();			 
    					 ListeCoordDistant=uController.GetCoordonnee(Location[0].getImmatRecherche());
    					 
    					if(ListeCoordDistant.size() > 0)
    					{  
    						Log.i("immatriculation True ","------> Resultat : "+ListeCoordDistant.size() );  
    						return true;	
    					}
    					else 
    						return false;
    				}  
    				catch (IOException e) {
    					// TODO Auto-generated catch block
    					e.printStackTrace();
    				} catch (Exception e) {
    					// TODO Auto-generated catch block
    					e.printStackTrace();
    				}	
    			
    			return false;
    			
    		}
    je ne comprend pas pourquoi, peut-être que je dois passer par un service car l'appel se fait en arrière plan ?

  2. #2
    Expert éminent

    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    4 253
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2007
    Messages : 4 253
    Points : 7 618
    Points
    7 618
    Billets dans le blog
    3
    Par défaut
    Regarde au moment de l'exception les objets en mémoire.

    Tu as peut-être une fuite mémoire quelque part ?
    N'oubliez pas de cliquer sur mais aussi sur si un commentaire vous a été utile !
    Et surtout

Discussions similaires

  1. Appel Web Service en C++ sous AIX
    Par qiqi1111 dans le forum Bibliothèques
    Réponses: 3
    Dernier message: 16/03/2009, 13h57
  2. [Axis 2] : pb appel web services avec paramètre à null
    Par Foub dans le forum Services Web
    Réponses: 1
    Dernier message: 06/01/2009, 07h31
  3. [WLS 8.1 SP5] log des requetes web services
    Par darkyspirit dans le forum Weblogic
    Réponses: 0
    Dernier message: 02/09/2008, 10h20
  4. Problème appel Web Service SharePoint
    Par bugmenot dans le forum Windows
    Réponses: 0
    Dernier message: 14/09/2007, 15h09
  5. [2.0][C#] appel web service
    Par lenoil dans le forum Services Web
    Réponses: 1
    Dernier message: 09/10/2006, 08h24

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo