On Thu, Nov 29, 2001 at 02:07:29PM +0530, Guru Prasad wrote: > > Dear All, > > I am using DBI version 1.19. I am using fetchall_arrayref function to get > all the records in a single strech. The table is having about 15000 > records. Now the memory occupied by the process increses by 20 MB. Once i > have finished processing the records, i am doing a proper > 'undef' to the array to release the memory. But it's not happening.
`undef'ing a variable causes the storage associated with that variable to be made available for reuse. Most of the time `reuse' means within the perl script, i.e., it is not released back to the operating system. This is most likely what you are seeing, you `undef' the variable but your program size remains large. > Can it be sorted out in program itself or at DBI level or is it a > problem in perl itself. It is most likely not a DBI issue, nor a ``problem'' with perl. It is just the perl way to handle memory. In general, not releasing the memory back to the operating system increases speed of execution (unless you gobble up so much memory your system starts swapping). I know of no way to force perl to purge its unused memory, but here are a couple things you could try: - put the array (as a my variable), fetch, and array processing in an eval block; or eval $code; - fork a child process and do the array processing in there - write a separate script to do the fetch and processing and backtick or system call it dd -- David Dooling Informatics
