Valgrind mmap error 22
Asked Answered
S

1

7

I am trying to run a program on Valgrind. But I am getting this error:

valgrind: mmap(0x67d000, 1978638336) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data or bss segments.

I am unsure what the issue is. I know that I have plenty of memory (I am running on a server with 500+ GB of ram). Is there a way of making this work?

Edit: Here are my program and machine details:

So my machine (it is a server for research purposes) has this much RAM:

$ free -mt
         total        used        free      shared  buff/cache   available
Mem:         515995        8750      162704          29      344540      506015
Swap:        524277         762      523515
Total:      1040273        9513      686219

And the program (named Tardis) size info:

$ size tardis
   text    data     bss     dec     hex filename
509180    2920 6273605188      6274117288      175f76ea8       tardis
Sporulate answered 8/2, 2017 at 22:17 Comment(7)
this can be caused by executables with very large text, data or bss segments. So does any of that apply to your situation or not?Roseleeroselia
Nothing in that message said anything about the amount of RAM on the box. It refers to your program, specifically it's text, data, or bss segments, none of which we know anything about, as we know nothing about your program.Robinette
500+ GB RAM? What beast of a machine is that? Or does that include virtual memory?Huesman
Look the accepted answer of following link. #4231329Marlinmarline
Roughly 6 GiB of BSS data (that's all bytes zero). That probably fits the 'very large bss segment' reason. Can you not dynamically allocate that memory instead — it will evade the problem.Vivienne
That will require some serious restructuring of the program. I mean since I have more than enough memory, shouldn't that just work? Could this be something with Valgrind only being able to address 4 GB of static memory address?Sporulate
Does this answer your question? Valgrind Error: failed in UME with error 22Vulgus
P
0

Unfortunately there is no easy answer to this. The Valgrind host has to load its text somewhere (and also put its heap and stack somewhere). There will always be conflicts with some guest applications.

It would be nice if we could have an argument like --host-text-address=0x68000000. That's not possible as the link editor writes it into the binary. It isn't possible to change this with ld.so. The only way to change it is to rebuild Valgrind with a different value. The danger then is that you get new conflicts.

Proulx answered 1/2, 2023 at 11:0 Comment(2)
Bit of a necromancy there. Actually the problem may have fixed itself in the six years since this was asked, nowadays valgrind is likely to be PIE (mine is) and get loaded into the dozens of TB range, which may make such a clash less likely.Aggrieve
6 years is a short time in the Valgrind world.Proulx

© 2022 - 2024 — McMap. All rights reserved.