# Cron memory problems



## FredMack (Oct 27, 2011)

Hi guys,

I have a perl script that is very memory intensive. It runs ok from the command line but when I run it through cron (as the same user) I get perl out of memory errors.

I've checked /etc/limits.conf and increased the values of kern.dfldsiz, kern.dflssiz, kern.maxssiz, kern.maxdsiz through /boot/loader.conf.

Running limits at the start of the script gives:


```
Resource limits (current):
  cputime              infinity secs
  filesize             infinity kB
  datasize             20971520 kB
  stacksize            20971520 kB
  coredumpsize         infinity kB
  memoryuse            infinity kB
  memorylocked         infinity kB
  maxprocesses             5547
  openfiles               11095
  sbsize               infinity bytes
  vmemoryuse             786432 kB
  pseudo-terminals     infinity
  swapuse              infinity kB
```

The error message from the script is:

```
Out of memory during "large" request for 528384 bytes,
total sbrk() is 764921856 bytes at script.pl line 225,
<F> line 92233.
```

Can anyone point me in the right direction?
Thanks!


----------



## shitson (Oct 27, 2011)

Does the script produce output? I would send any output to a log.txt to ensure that your program is doing what you expect when running under cron.


----------



## idle (Nov 3, 2011)

Drop your data to the disk. 
	
	



```
use DBM::Deep;
```
 Thus free the memory.
http://www.perlmonks.org/?node_id=533663


----------

