1849586 Members
6899 Online
104044 Solutions
New Discussion

ulimit -m 10000

 
EML
Advisor

ulimit -m 10000

I was trying to limit the memory usage of one process by doing the following commands on a terminal:
1)ulimit -m 10000
2)ulimit -a
:::result show that memory set is 10000:::
3)run the process on this shell.

When process starts to do something, I see on the top command that it is consuming more than 10Mbytes memory still. Is this ulimit working in HP-UX 11.0? Is there something I missed on my procedure?

Thank you very much in advance for the help.
3 REPLIES 3
Jerome Baron
Respected Contributor

Re: ulimit -m 10000

Hi,

Im sh-posix(1) manpage we don't have option -m for ulimit :
ulimit [-HSacdfnst] [limit]

Set or display a resource limit. The limit for a specified
resource is set when limit is specified. The value of limit can
be a number in the unit specified with each resource, or the
keyword unlimited.

The -H and -S flags specify whether the hard limit or the soft
limit is set for the given resource. A hard limit cannot be
increased once it is set. A soft limit can be increased up to
the hard limit. If neither -H nor -S is specified, the limit
applies to both. The current resource limit is printed when
limit is omitted. In this case, the soft limit is printed unless
-H is specified. When more than one resource is specified, the
limit name and unit are printed before the value.

If no option is given, -f is assumed.

-a List all of the current resource limits.
-c The number of 512-byte blocks in the size of core
dumps.

Hewlett-Packard Company - 18 - HP-UX Release 11.00: March 2002

sh-posix(1) sh-posix(1)

-d The number of kilobytes in the size of the data area.
-f The number of 512-byte blocks in files written by child
processes (files of any size can be read).
-n The number of file descriptors.
-s The number of kilobytes in the size of the stack area.
-t The number of seconds to be used by each process.

What shell do you used ?

Regards,
Jerome
Robert-Jan Goossens
Honored Contributor

Re: ulimit -m 10000

Hi,


You look at the man page of the shell you are using.

#echo $SHELL

and locate the ulimit variables.

The max value of "data" that you are trying to set is determined by the kernel parameter "maxdsiz". So you have to bump up "maxdsiz" for this to work. Use ..

# ulimit -aS

to look at your current soft limit setting.

Robert-Jan.

Jean-Louis Phelix
Honored Contributor

Re: ulimit -m 10000

Hi,

I can't find any information about this undocumented option, and I can't either find any difference between setting it or not. But '-d' option should be better :

- compile this one line program a.c using 'make a',

> ulimit -m 1
> a
> ulimit -d 1
> a
sh: There is not enough memory available now.

So -d if much more efficient ...

Regards
It works for me (© Bill McNAMARA ...)