AlluRajasekhar
14th October 2008, 21:05
Hi All,

I have this problem of "running low on memory" when I run a customized process session on Baan IV C4. Let me explain the program logic ...

There are around 220 files placed on a file server. Each file will have close to 3000 and odd Items listed in it. My process session is supposed to process these Items and come out with a list of all the alternate items for each item in the file. The same has to be done for all 220 files. The out put has to written onto a ASCII file.

The problem - Every time I run this process session I would get a fatal error Running on Low memeory. Before I get this error the session would have processed around 45 - 50 files out of 220 files.

I then tried to write the output to seperate files. In other words each file output is written onto unique ascii file. Even then I get this fatal error of running low on memory.

I have checked user limit using command "ulimit -a". It has memory of kbytes 32768. Do you think that this is the problem? Please note that I have used couple of arrays but memory allocation/de-allocation for those arrays is done dynamically for each file.

Any suggestion on this is very helpfull for me.

Thank you.

norwim
14th October 2008, 23:26
Hi there,

assuming that you are already doing seq.close() on each file you processed there might still be the possibility that memory isn't correctly released - just a guess, I never ran into this problem.
On the other hand you could try to validate that the problem really has nothing to do with your arrays by commenting them out and for a test just open and close all the 220 files to see if the problem persists.
If it's possible without too much reprogramming, I would try to convert the session into a subsession which processes one file at a time and call this session from another session for each file to be processed - perhaps this could help.
On the other hand I often call shell scripts using awk scripts to solve batch file processing problems which might need HUGE arrays - if your problem can be solved in such a way then this solution should be easy. In other words - if your program logic works with one control file that contains "item:alternative item" then it should be easy to create this control file with a Baan session and process the 220 files with awk and the control file .... but this assumes that you don't need access to Baan DB when you process these files.
Feel free to contact me if you need help with awk.

hth

Norbert

AlluRajasekhar
15th October 2008, 14:25
Hi Norwin,

Your suggestion paid off. The session processed all the 220 files without throwing up fatal error Running low on memory.

What I did - Developed a new sub session taht would process each file and then gets closed.

Thank you.

NPRao
18th October 2008, 04:02
Rajasekhar,

You should always use seq.close() for every seq.open()
You should have got this error -
24 EMFILE - Too many open files
Description:
This error indicates that too many file descriptors are open. No user is allowed to open any file.

Solution:
No process can have more than 20 file descriptors open at a time. Ask your system administrator to change the following parameters to increase the number of open files that is allowed:
The NOFILES parameter, which defines the maximum number of open files per process and must have minimum value of 256. Preferably more.
The NFILE parameter, which defines the number of open files in Baan and must have minimum value of NOFILES * BAAN User License * 3 + 100. Preferably more
Also refer to the HP-UX documentation for - nfile (http://docs.hp.com/en/B3921-90010/nfile.5.html)