I have data shared memory which i am using as lookup space.I have key and its associated data which i am storing in DSM(data shared memory)In certain cases
when i am trying to retrieve the data the look up fails although there is a data in memory of that key.
I think this could be the issue due to the key size(in this it is 70 bytes).
Anyone face the similar issue can help me on this.
highly appreciate the help.
It's just a guess, but does your shared memory contain any pointers? There is usually no guarantee that the shared memory will be put at the same location in the memory space of the two processes. Thus you can't have any pointers in it. You have to use offsets instead.
You said it's in shared memory, which means it's shared between processes, right? My point is that process A and process B might have the shared memory mapped to different addresses. You are correct that in one invocation of one process, the address won't move, but two different processes running at the same time could see the shared memory in different places.
This is all thanks to the magic of virtual memory.