java.lang.OutOfMemoryError
java.lang.OutOfMemoryError
- Subject: java.lang.OutOfMemoryError
- From: Ricardo Strausz <email@hidden>
- Date: Thu, 10 Apr 2003 11:10:30 -0600
Szia mindenki!
I just recived the following error:
2003-04-10 10:50:48.720 Clientes[649] java/lang/OutOfMemoryError
Stack Trace:
java.lang.OutOfMemoryError
<<no stack trace available>>
I have to do some statistics in a not-to-log database (5,000 clients x
50,000 invoices) but I am running out of memory... well, from Java's
point of view, becouse I have 512MB in RAM and 1.3GB in HD, and, at the
end my disk is equal in size.
Is there some way to assign more memory to the JVM??
Does it uses my VM??
I show down my code; is there an ease way to do it more efficient??
Thanks in advance
Dino
- (IBAction)monto:(id)sender
{
NSArray* nsa = [dgClientes displayedObjects];
NSEnumerator* en = [nsa objectEnumerator];
id eo = nil;
NSArray* facturas = nil;
int i = 0;
int j = 0;
BOOL ok = YES;
int cambiaron = 0;
int MESES = [[forma cellAtIndex:0] intValue];
int BLOQUES = [[forma cellAtIndex:1] intValue];
if([nsa count]>0) eo = [en nextElement];
else return;
while(eo != nil){
facturas = [self ordena:[self facturasDe:eo]
enBloquesDeTamanyo:MESES desde:[NSCalendarDate dateWithString:@"1 1
1996" calendarFormat:@"%m %d %Y"]];
if([facturas count]>BLOQUES){
for(i=0;i<[facturas count]-BLOQUES;i++){
for(j=0;j<BLOQUES;j++){
if([[facturas objectAtIndex:i+j] count]>0) ok = YES;
else {
ok = NO;
break;
}
}
if(ok){
[eo setGrupo:[NSNumber numberWithInt:MESES]];
cambiaron++;
break;
}
}
}
NS_DURING
eo = [en nextElement];
NS_HANDLER
eo = nil;
NS_ENDHANDLER
}
[[forma cellAtIndex:2] setIntValue:cambiaron];
}
- (NSArray*)facturasDe:(id)eo
{
NSString* nss = [NSString stringWithFormat:@"cliente=%@ and
estado>0",[eo folio]];
id eoq = [EOQualifier qualifierWithQualifierFormat:nss:nil];
NSArray* nsa = nil;
[[dgFacturas dataSource] setAuxiliaryQualifier:eoq];
[dgFacturas fetch:self];
nsa = [dgFacturas displayedObjects];
return nsa;
}
- (NSArray*)ordena:(NSArray*)nsa
enBloquesDeTamanyo:(int)meses
desde:(NSCalendarDate*)desde
{
NSMutableArray* nsmaa = [NSMutableArray array];
NSMutableArray* nsmab = [NSMutableArray array];
NSCalendarDate* nscda = desde;
NSCalendarDate* nscdb = [nscda dateByAddingYears:0
months:meses
days:0
hours:0
minutes:0
seconds:0];
NSEnumerator* en = [nsa objectEnumerator];
id eo = nil;
NSCalendarDate* eoFecha = [NSCalendarDate alloc];
if([nsa count]>0) eo = [en nextElement];
else return nsmaa;
while(eo != nil){
[eoFecha initWithString:[[[eo fecha] toString]
substringToIndex:11]
calendarFormat:@"%Y-%m-%d"];
if([[eoFecha laterDate:nscda] isEqual:eoFecha]
&& [[eoFecha laterDate:nscdb] isEqual:nscdb]){
[nsmaa addObject:eo];
NS_DURING
eo = [en nextElement];
NS_HANDLER
eo = nil;
NS_ENDHANDLER
} else {
[nsmab addObject:nsmaa];
nsmaa = [NSMutableArray array];
nscda = nscdb;
nscdb = [nscda dateByAddingYears:0
months:meses
days:0
hours:0
minutes:0
seconds:0];
}
}
[eoFecha release];
return nsmab;
}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.