1833012 Members
2807 Online
110048 Solutions
New Discussion

ld with Malloc errors

 
SOLVED
Go to solution
Tony Bentley_1
Occasional Contributor

ld with Malloc errors

Attempting to create a shared-library using the ld command. "ld -b -/t07/m201/lib/librc.sl followed by long list of object files. 407 objects.

I receive the following error:
Malloc is out of memory, leaks over 512k:
ld: Out of memory
Malloc: 62721632 bytes allocated by Unknown:0x61b7
Malloc: 2146304 bytes allocated by Unknown:0x30ff3
*** Error exit code 1

Stop.

Any help on Kernel Parameter which need to be tuned or is there a Patch for the linker?
Thanks,
Tony
4 REPLIES 4
Andy Bennett
Valued Contributor
Solution

Re: ld with Malloc errors

Increase 'maxdsiz'. Given the numbers in the error, I would guess you still have the default 64Mb value for this and ld probably just ran out of temporary space.
Rita C Workman
Honored Contributor

Re: ld with Malloc errors

This is from the Memory Management White Paper:

The data segment contains a process's initialized and uninitialized data structures (bss). It can grow as needed by a program's run-time logic (using sbrk(2), malloc(3C), or malloc(3X), as described in the HP-UX Reference). The total allotment for initialized data, uninitialized data and dynamically allocated memory can be changed by the configurable operating-system parameter maxdsiz.

But......I would look at more than just this parm. For example do you have pseudo swap turned on (I would)...and others. I think we'd need more details to give better suggestions.

/rcw
Carl Erhorn
Advisor

Re: ld with Malloc errors

I'd be interested in any follow ups on this, as I have the exact same problem.

Maxdsize has been set to the maximum SAM allows for our system, and we have almost a gig of free swap space available. Limits for the system show memory as 'unlimited', datasize as 2GB, and stacksize as 8MB.

I suspect that stacksize is the culpret, yet
we do not get stack errors, just the message mentioned above. We are in the same situation, creating a very large shared library from a large number of object files.

We are stuck until this problem is resolved.
Any gurus out there that know the answer?

Thanks,
--Carl
Tony Bentley_1
Occasional Contributor

Re: ld with Malloc errors

Hi everyone,

I guess I was a bit to busy to reply to this.

By increase maxdsiz and maxssiz to 1073741824 and 65011712 respectively, I was able to create the shared library with 348 objects for a total size of 31100928. This was accomplished on two different systems. Each system had the same problem until I increased the size of maxdsiz and maxssiz. Even on 64bit HP11.0, I needed to increase these parameters for the 32bit application.

Regards,
Tony