Why does valgrind give me this warning?
==22715== Warning: set address range perms: large range [0x59c99000, 0x159c99000) (noaccess)

Also I don't really understand why it's giving me this one either. ftruncate is being passed a valid file handle and length, both have been initialized.

==22902== Syscall param ftruncate(length) contains uninitialised byte(s)

@gudenau How do you initialize it? If you do something like

void get_length(int*);

off_t len;
ftruncate(fd, len);

then because off_t is 8 bytes long and int is 4 bytes long (on my system), there are uninitialized bytes.

@Neui I'm using uint32_ts and setting them without using pointers. Basically, but not exactly:

Thing::Thing (u32 length) {
this->length = length;
handle = [open];

void Thing::op(void){
ftruncate(handle, length);

@gudenau Since setting the memory protection across 4 GiB of address space is a lot ("large range" part of the message). Looks like the minimum it'll give a warning for is 256 MiB[1]. Also, the documentation states: "Diagnostic message, mostly for benefit of the Valgrind developers, to do with memory permissions."[2].


Sign in to participate in the conversation
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!