Mapping views of a MMF
-
Hello, I'm experiancing some trouble with an MMF. I've created a class that manages one MMF and one view of that file. I've also created another class that manages some cache using the MMF class. The MMF class has no problems of its own that I'm aware of, but the caching class has a problem when a new view has to be created. After I cross the view boundraries (and map a new view), one pointer in the heap becomes invalid. The data it holds is still the same, but
operator delete[]
asserts with an invalid heap pointer exception. I must also note that the base address of the view is almost the same as the variable. The base address = 0x01b40000. The address of the variable is: 0x01c0e988 and the size is 72 bytes. To me it seems that the variable is not in the view, but I don't know why my pointer is corrupted. After the initial write I perform some validation checks:IsBadReadPointer()
to be precise and it succeeds. Did anybody experiance something like this before? Anybody has any idea what might be the problem? Behind every great black man... ... is the police. - Conspiracy brother Blog[^] -
Hello, I'm experiancing some trouble with an MMF. I've created a class that manages one MMF and one view of that file. I've also created another class that manages some cache using the MMF class. The MMF class has no problems of its own that I'm aware of, but the caching class has a problem when a new view has to be created. After I cross the view boundraries (and map a new view), one pointer in the heap becomes invalid. The data it holds is still the same, but
operator delete[]
asserts with an invalid heap pointer exception. I must also note that the base address of the view is almost the same as the variable. The base address = 0x01b40000. The address of the variable is: 0x01c0e988 and the size is 72 bytes. To me it seems that the variable is not in the view, but I don't know why my pointer is corrupted. After the initial write I perform some validation checks:IsBadReadPointer()
to be precise and it succeeds. Did anybody experiance something like this before? Anybody has any idea what might be the problem? Behind every great black man... ... is the police. - Conspiracy brother Blog[^]Well, I solved the problem. The problem was not in unmapping the view, not in mapping the view, it was in the function which calculated the offset of the data in the view. The offset was reset when a new MMF was created, but not when a new view of a MMF was created. This lead to writing outside the view, which in turn corrupted the heap. I guess that a complete heap check is done after each allocation and deallocation. Behind every great black man... ... is the police. - Conspiracy brother Blog[^]