WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Error Codes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

3397: List Itemization: Could not allocate global buffer

Keywords: 	 3397: List Itemization: Could not allocate global buffer

Question:

I wrote a program which keeps on running and writes some information to a log file. Searching the right log file, I use the function FileItemize.

However sometimes (not everytime the function is executed) the program terminates with the error: 3397: List Itemization: Could not allocate global buffer

This error seems strange to me because it only happens a few times a day. I thought about some memory problem, so I dropped the variable containing the results of the FileItemize function. However the error still exists.

Is there anyone who can tell me what is going on and what is meant by the "global buffer"?

More Info: I use the FileItemize function to see all the logfiles in a directory. The size of each log file is limited to 10MB, the number of logfiles in the directory is growing each time. However at this moment, 10-20 files are located in the directory.

If the Winbatch program is restarted, the FileItemize function does not give an error anymore. Only after a few hours of running the "Could not allocate global buffer" error occurs. The Winbatch program should be running in loop for ever. Might this be a problem?

Answer:

This tends to indicate that WinBatch cannot grab any memory for working with. This can be caused by a memory leak in either Winbatch itself or in your script.

Currently I suspect your script? How big is it? Does it allocate any Binary Buffers or arrays?

The general technique here is:

  1. Find a script that will crash eventually.
  2. Comment out some code that seems irrelevent to the crash. Test again.
  3. If it still crashes, comment out more code. If it did not crash put the code back in and comment out different code.
  4. Try to boil the problem down to a minimal test case that illustrates the problem with only a few lines of code.

Question (cont'd):

My script is about 640 lines and uses 3 arrays. However because the script is running in a loop the function, allocating the arrays, is called different times.

Variables declared in a function, will they be de-alocated automatically by Winbatch or should I do an manual drop? Should I try dropping the variable arrays?

For now I will use your workaround, exiting the script on an error. The script is restarted automatically, using the winNT schedule service.

Answer:

It *should be* automatic.

Drops should not be required.


Article ID:   W14845
File Created: 2001:11:08:12:40:20
Last Updated: 2001:11:08:12:40:20