1834757 Members
3140 Online
110070 Solutions
New Discussion

brk system call failed

 
SOLVED
Go to solution
Camel_1
Valued Contributor

brk system call failed

Hi there,

I was tracing a application which failed on memory allocation.

The tusc out shown the following

brk(0x79e20000) .................................................... ERR#12 ENOMEM

Which does the hex value mean? Is the the size in bytes?

The maxdsiz & maxssiz set on the server as belows (HPUX11i)

maxdsiz 0x50000000
maxdsiz_64bit 0x80000000
maxssiz 0x8000000
maxssiz_64bit 0x40000000
maxtsiz 0x8000000
maxtsiz_64bit 0x80000000

Is it necessary to increase any value to make the program works?

Thanks,

Simon
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: brk system call failed

The value is a pointer for the end of the data segment. It means that you have bumped into maxdsiz for 32-bit programs or maxdsiz_64bit for 64-bit programs. It could also fail below maxdsiz if no more virtual memory were available (ie out of swap space).
If it ain't broke, I can fix that.
Ermin Borovac
Honored Contributor

Re: brk system call failed

brk value is an offset from the start of the second quadrant (Q2) which is at 0x40000000. Subtract these two numbers and you will find out how much memory program tried to allocate. The end of the second quadrant is at 0x80000000.

It looks like you have 32-bit program, so it may be possible for it to allocate more than 1G by using chatr

# chatr +q3p enable +q4p enable

This will allow use of private data in third and forth quadrant, which should give you an extra 2G.

You will also need to bump up maxdsiz and maxdsiz_64bit accordingly.

All of this assumes that you have enough virtual memory (RAM + swap) configured in your system.