Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Mapping views of a MMF

Mapping views of a MMF

Scheduled Pinned Locked Moved C / C++ / MFC
comtoolshelpquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bob Stanneveld
    wrote on last edited by
    #1

    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[^]

    B 1 Reply Last reply
    0
    • B Bob Stanneveld

      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[^]

      B Offline
      B Offline
      Bob Stanneveld
      wrote on last edited by
      #2

      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[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups