[S] attach() in a loop exhausts memory

McCormick, Devon (Devon.McCormick@bankerstrust.com)
Fri, 7 Aug 1998 11:03:17 -0400


(submitting this on behalf of Mark Leeds)
Hi:

I am a non-expert splus programmer and I have the following problem.

Within a loop, I call a function that begins with 2 attach statements
because it needs to know about some objects that are in other Splus
databases; these databases get detached when the function is done.

I get hung up with a permanent hourglass after about 50 iterations.

I know what is going on but I am unsure how to fix it.
Using mem.tally.report, I see that new memory is allocated
every time the function is called within the loop, so eventually
I run out of memory.

The attach statements at the top of the function must be causing the
problem because a different function without these works OK.

I got my code to work by taking everything out of functions and making
it all one big program but this is ugly.

Pseudocode follows:

for ( i in 1:numiterations ) {

call dumfunca

}

dumfunca_function() {

attach("c:\\.....,pos=2)
attach("c:\\.....,pos=3)

do some stuff

detach(where=3)
detach(where=2)

}

-- Mark Leeds

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news