1826217 Members
3127 Online
109691 Solutions
New Discussion

ld: out of memory

 
Sabrina Lautier
Advisor

ld: out of memory

Hi,

Developers use the native HP linker /usr/ccs/bin/ld to link objects on an HP-UX 11.11 server (RP8400). When its size in memory (VSZ) reaches 2GB, it fails and the error message 'out of memory' is printed. Note that the amount of free available memory and swap when the error occurs is OK.

VSZ PID PPID COMMAND
1941968 25597 25592 /usr/ccs/bin/ld -o
../../../bin/HP-UX11_64/SingleThread/Release
VSZ PID PPID COMMAND
1941968 25597 25592 /usr/ccs/bin/ld -o
../../../bin/HP-UX11_64/SingleThread/Release
VSZ PID PPID COMMAND
1941968 25597 25592 /usr/ccs/bin/ld -o
../../../bin/HP-UX11_64/SingleThread/Release
VSZ PID PPID COMMAND -> !! process defunct !!
VSZ PID PPID COMMAND

The following actions didn't solve the issue:
- Apply ld patch PHSS_33033
- tune kernel parameters maxdsize, masssize and maxtsize to the max allowed value for 32 bits (respectively: 4294963200, 401604608, 1073741824)
- chatr +q3p /usr/ccs/bin/ld

For information:
$ file /usr/ccs/bin/ld
/usr/ccs/bin/ld: PA-RISC1.1 shared executable dynamically linked
$ what /softs/C++Compiler/bin/aCC
/softs/C++Compiler/bin/aCC:
$Revision: 92453-07 linker linker crt0.o B.11.30 020412 $
HP aC++ B3910B A.03.39
HP aC++ B3910B A.03.33 Language Support Library

Can someone explain and give a solution ?

Many thanks in advance for your help.
Rgds,
Sabrina
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor

Re: ld: out of memory

The first thing that I would do is greatly reduce maxssiz. It's somewhat counterintuitive until you realize that the stack and data segments can be common so that effectively the maximum size of the data segment can be reduced by the size of the stack. 32-bit maxssiz should be no larger than about 64MiB and even 64-bit applications almost never need a stack larger than this --- unless they are poorly written. I fould set maxssiz to 32MiB and maxssiz_64bit to 64MiB and give that a try.
If it ain't broke, I can fix that.
Steve Lewis
Honored Contributor

Re: ld: out of memory

Also,

I would point out that if your developers are using cc +O4 or LDOPTS that include linker optimisation, you can run out of 32 bit memory space for a large program regardless of what your settings are. Check the compiler and linker options and if necessary, re-link without linker optimisations.

Steve
Dennis Handly
Acclaimed Contributor

Re: ld: out of memory

>Steve: if necessary, re-link without linker optimisations.

You can't. You must recompile without +O4.
Sabrina Lautier
Advisor

Re: ld: out of memory

Thx all for you help.

Apparently the pb seems to come from ld_32bits as developpers just confirmed that it works fine on a SLES9 server with ld_64bits:

SLES9> file /usr/bin/ld
/usr/bin/ld: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), stripped

I would like to install it but where to find it ? That is the question...

Rgds,
Sabrina
Dennis Handly
Acclaimed Contributor

Re: ld: out of memory

First of all, you need to do what Clay says to get 350 Mb back.

Then you need to investigate what Steve and I said to make sure the process in question isn't ucomp, instead of ld. (Are you compiling with +O4, or +I/+P?) ld may do an exec so the name isn't changed. If it really is ld, you may want to look at the -T option.

>Apparently the pb seems to come from ld_32bits as developers just confirmed that it works fine on a SLES9 server with ld_64bits:
/usr/bin/ld: ELF 64-bit LSB executable, AMD x86-64,

This is meaningless since this is X86-64, not PA-RISC.

>I would like to install it but where to find it

If you really need a 64 bit linker, you'll have to go to IPF.
Sabrina Lautier
Advisor

Re: ld: out of memory

Well, I made test on an other HP-UX 11.11 target machine and I found a solution: in fact ld (/usr/ccs/bin/ld) uses ld64 (/usr/ccs/lbin/ld64) - this I didn't know -, and the 3rd quadrant private data space was enabled for ld and not ld64. Enabling the 3rd quadrant private data space for ld64 solved the pb: chatr +q3p enable /usr/ccs/lbin/ld64.

Notes:
- The data seg size must be set properly by ulimit (in our case 3GB or more).
- ld64 is NOT a 64bit binary as we could think, and HP cannot provide us with a 64bit ld binary.

The kernel parameters maxdsize, masssize and maxtsize are respectively 3221225472, 83570688 and 268435456. I only increased maxdsize from 2GB to 3GB.

As enabling the 3rd quadrant private data space didn't seem to be regular behaviour for me I searched a 64 bit ld but in vain... the HP support told me I couldn't get any.

Thx to those who have replied.

Rgds,
Sabrina