Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

datalock(3c) [hpux man page]

datalock(3C)															      datalock(3C)

NAME
datalock() - lock process into memory after allocating data and stack space SYNOPSIS
DESCRIPTION
allocates at least datsiz bytes of data space and stsiz bytes of stack space, then locks the program in memory. The data space is allo- cated by (see malloc(3C)). After the program is locked, this space is released by (see malloc(3C)), making it available for use. This allows the calling program to use that much space dynamically without receiving the signal. The effective user ID of the calling process must be super-user or be a member of or have an effective group ID of a group having PRIV_MLOCK access to use this call (see setprivgrp(2) in getprivgrp(2)). EXAMPLES
The following call to allocates 4096 bytes of data space and 2048 bytes of stack space, then locks the process in memory: RETURN VALUE
returns -1 if cannot allocate enough memory or if returned an error (see plock(2)). WARNINGS
Multiple datalocks cannot be the same as one big one. Methods for calculating the required size are not yet well developed. AUTHOR
was developed by HP. SEE ALSO
getprivgrp(2), plock(2), thread_safety(5). datalock(3C)

Check Out this Related Man Page

CHMEM(1)						      General Commands Manual							  CHMEM(1)

NAME
chmem - change memory allocation SYNOPSIS
chmem [+] [-] [=] amount file EXAMPLES
chmem =50000 a.out # Give a.out 50K of stack space chmem -4000 a.out # Reduce the stack space by 4000 bytes chmem +1000 file1 # Increase each stack by 1000 bytes DESCRIPTION
When a program is loaded into memory, it is allocated enough memory for the text and data+bss segments, plus an area for the stack. Data segment growth using malloc , brk , or sbrk eats up stack space from the low end. The amount of stack space to allocate is derived from a field in the executable program's file header. If the combined stack and data segment growth exceeds the stack space allocated, the pro- gram will be terminated. It is therefore important to set the amount of stack space carefully. If too little is provided, the program may crash. If too much is provided, memory will be wasted, and fewer programs will be able to fit in memory and run simultaneously. MINIX does not swap, so that when memory is full, subsequent attempts to fork will fail. The compiler sets the stack space to the largest possible value (for the Intel CPUs, 64K - text - data). For many programs, this value is far too large. Nonrecursive programs that do not call brk , sbrk , or malloc , and do not have any local arrays usually do not need more than 8K of stack space. The chmem command changes the value of the header field that determines the stack allocation, and thus indirectly the total memory required to run the program. The = option sets the stack size to a specific value; the + and - options increment and decrement the current value by the indicated amount. The old and new stack sizes are printed. SEE ALSO
install(1), brk(2). CHMEM(1)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to find the size of Process Address space.

Hello, Please help me to know, How to find out the how much amount of process addres space is required/is used for/by a process. Tnx & Regards Vishwa. (1 Reply)
Discussion started by: S.Vishwanath
1 Replies

2. Programming

memory increasing on UNIX

hi, i'm writing a program that is running always... but, i have a problem that memory is increasing.. i want to know whether does stack size inscease or not, when program is running.. i don't know what is the cause stack or heap... i need some help.. :( (1 Reply)
Discussion started by: netfer
1 Replies

3. UNIX for Dummies Questions & Answers

problem editing big file in vi

I have a big file, which vi opens it with message not sufficient space with file system. I am not adding any data in the file but changing some values within. To make these changes effective, it asks for forced write (w!), even after doing this, I see this particular record, change is not... (4 Replies)
Discussion started by: videsh77
4 Replies

4. Programming

How to handle memory error?

Hi, I need to know what is the right way of handling out of memory conditions. If a program is not able to dynamically allocate memory (new fails), is it right to wait for some amount of time (say 5 sec) and then try again to allocate memory? Or should we kill the process and again restart it?... (1 Reply)
Discussion started by: diganta
1 Replies

5. Programming

memory stack problem

Hi, I am writing a C program under SCO Unix. I have a memory stack problem but do not know how to go about fixing it. I have tried running INSURE but that does not detect any problems. Essentially the problem is that the memory address shifts on return from a routine. I pass a pointer to... (3 Replies)
Discussion started by: jkeagy
3 Replies

6. Filesystems, Disks and Memory

how to find memory capacity.

Hi, In Sun solaris o/s how can i find the memory space available,Swap space. By giving df command i can get the disc space. I want RAM space & swap space. If anybody assist me.that is great. Thanks (2 Replies)
Discussion started by: Mar1006
2 Replies

7. UNIX for Dummies Questions & Answers

upper limit of accessible memory space for a single process in Unix/Linux

Hellp all, if there is 3G memory in my Unix server I want to know if all the 3G space can be used by ong sigle process. As i know, in Windows, one process can only access at most 1G memory despite there is probably more than 1G memory is equipped. (1 Reply)
Discussion started by: cy163
1 Replies

8. Programming

Process crash when allocating memory

Hi I'm currently using C++ on a HP-UX 11i system (upgrading some libraries) and am encountering a problem with the process crashing when allocating memory via a call to new (a rather large array of objects are being created). Is there a way to find out what the sizes of the stack and heap are?... (1 Reply)
Discussion started by: themezzaman
1 Replies

9. Shell Programming and Scripting

Storing string with space (urgent)

hi i have a file content like my_file: 1US8738297897918000 000 000 i used while IFS= read line do echo "$line" | grep '^\ then last=`echo "$line" | cut -c 3-20` echo "$last" fi done < $my_file but it is writing blank spaces into the o/p fie (1 Reply)
Discussion started by: Satyak
1 Replies

10. Programming

Measuring memory used by a program?

I have a Java program. I want to measure the total memory used by the program, especially the peak memory. Is there a way to do it? I have tried utilities like time (which returns 0) and top (which is not very useful) as the program does not run for long. Can anyone suggest a way to do this?... (5 Replies)
Discussion started by: spathical
5 Replies

11. Programming

malloc gives the same memory to two different nodes. How to deal with it?

When allocating memory for two different nodes, the resulting memory are the same. Clearly, this will lead to a mistake. This happened in a function. And the process must be in a function. (gdb) p tree->list $43 = (node *) 0x8be4180 (gdb) p tree->list $44 = (node *) 0x8be4180 At the... (2 Replies)
Discussion started by: cdbug
2 Replies

12. Programming

Memory usage

Hi., I want to know amount of memory used by a process inside the same process. For example, I am writing a program and I want to know the memory used by it from the program. So, I could do some actions (flush some unwanted data structures/ log the memory usage) in my program based on this... (2 Replies)
Discussion started by: nagalenoj
2 Replies

13. Shell Programming and Scripting

Replace long space to become one space?

Hi, i have the log attached. Actually i want the long space just become 1 space left like this : Rgds, (12 Replies)
Discussion started by: justbow
12 Replies

14. Shell Programming and Scripting

Error PHP Fatal error: Allowed memory size of 67108864 bytes exhausted(tried to allocate 401 bytes)

While running script I am getting an error like Few lines in data are not being processed. After googling it I came to know that adding such line would give some memory to it ini_set("memory_limit","64M"); my input file size is 1 GB. Is that memory limit is based on RAM we have on... (1 Reply)
Discussion started by: elamurugu
1 Replies

15. Programming

PC RAM and process address space

Suppose I have 3 gb of ram and 250 gb hard disk in my pc. Now I wrote a simple C program having only one statement malloc() to allocate 4 gb of memory as 32 bit os can address 4gb address space then will the malloc succeed? If yes then how it will get extra 1 gb of memory? Does the process gets... (3 Replies)
Discussion started by: rupeshkp728
3 Replies