My first guess is that you return the data structure you just edited in place for some reason. Keep in mind that Perl return the last evaluated expression if there's no return statement. Try putting a return; as the last line in the sub. Without code to look at, there's not much more specific anyone can say. Sorry if this isn't the source of your troubles. | [reply] [d/l] |
hi
I was returning a 1 "return 1;", I have changed it to "return;" I will see what happens. I also have tried undef'ing many of the data structures within the sub after I am done with them and before the sub returns. The funny thing is that in this sub, I am printing info to stdout and if I comment out of some of these print statements and then run, it works ok and completes, but when I print everything I need to STDOUT it dies.
| [reply] |
That's a peculiar sounding behavior. Is there any way you can reproduce the problem in a suitably short and nonproprietary snippet?
Returning a one should mean it wasn't the problem I suspected, BTW. Leaving that in place instead of using a bare return should be fine. The usual reason for such a memory jump is copying some sort of large data structure, so you might want to look for other reasons that might happen.
Another possible scenario just popped into my head, but it's pure speculation. Are you perchance calling the subroutine inside a while ( <filehandle> ) { .. } loop? If you are and it's a large binary file, it might be hundreds of megabytes before a newline appears. Again, a reproduction of the problem in a short snippet that doesn't give up any private data would be nice.
| [reply] [d/l] |
Not much to go on in what you posted. What's the return value, how big is it, and what do you do with it? | [reply] |
Methinx further details might prove useful.
Other than that, how big is the file from which I infer the %datFile is loaded ?
A user level that continues to overstate my experience :-))
| [reply] [d/l] |