Foros del Web » Programación para mayores de 30 ;) » Java »

<b>CONCATENACION...ERROR OUT MEMORY</b>

Estas en el tema de <b>CONCATENACION...ERROR OUT MEMORY</b> en el foro de Java en Foros del Web. hola a todos.... les presento el siguiente problemilla...necesito concatenar n palabras (<5)en base a palabras que se encuentran en un arraylist. El problema esque concatenando ...
  #1 (permalink)  
Antiguo 30/11/2009, 19:16
 
Fecha de Ingreso: octubre-2004
Mensajes: 79
Antigüedad: 19 años, 6 meses
Puntos: 0
<b>CONCATENACION...ERROR OUT MEMORY</b>

hola a todos....


les presento el siguiente problemilla...necesito concatenar n palabras (<5)en base a palabras que se encuentran en un arraylist. El problema esque concatenando 2 palabras...no existe ningun problema..pero cuando causa recursividad por sobre 2 palabras..me manda una excepcion
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

un trozo del codigo es el siguiente..agradeceria su ayuda

public void crear_sugerencias(){
try{
String pal="";
int pos=0;
int a=0;
int b=0;
int c=0;
int cant=0;
int pos_siguiente=0;
int largo=0;

for(int i=0;i<lista.size()-1;i++){
pal=lista.get(i).toString();
// sugerencia.add(pal);
largo=pal.length();
pos=texto.indexOf(pal,pos+1);
pos=pos+largo;
String sigui=lista.get(i+1).toString();
pos_siguiente=texto.indexOf(sigui);

int result=pos_siguiente-pos;

if(result<=2){
pal.concat(" "+sigui);
while(cant<=5){
a=articulo(sigui);
b=preposicion(sigui);
if(a>=1 | b>=1){
sigui=lista.get(i+2).toString();
String sigui2=lista.get(i+3).toString();
c=distancias(sigui,sigui2);
pal.concat(" "+sigui);
i=i+1;
sugerencia.add(pal);
if(c<=2){
sigui=sigui2;
}
}else{ sugerencia.add(pal);
}
StringTokenizer st = new StringTokenizer(pal);
cant=st.countTokens();
}
} }
Iterator muestra= sugerencia.iterator();
while(muestra.hasNext()){
System.out.println("muestra: "+muestra.next());
}
}catch(Exception e){
System.out.println("error sugerencias:"+e);
} }
  #2 (permalink)  
Antiguo 01/12/2009, 01:48
Avatar de Fuzzylog  
Fecha de Ingreso: agosto-2008
Ubicación: En internet
Mensajes: 2.511
Antigüedad: 15 años, 8 meses
Puntos: 188
Respuesta: <b>CONCATENACION...ERROR OUT MEMORY</b>

Puedes tratar de ver con system.out (imprimiendo en pantalla) en q parte del código se te produce el error? Así lo podrías delimitar.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:15.