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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Memory could not be written

Memory could not be written

Scheduled Pinned Locked Moved C / C++ / MFC
helpperformancequestionannouncement
5 Posts 4 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.
  • J Offline
    J Offline
    jkav
    wrote on last edited by
    #1

    Hi There, I am getting error "Memory could not be written" only in release mode and that too not on my machine. I thought of using MAPinfo to get the line number/function call where application is crashing. Unfortunetly address shown in error message doesnt come close to addresses mentioned in my MAP file. I am very very confused, not getting any way to find this crash. My memory address in MAP file starts from "0x00400000" to "0x004002xxxx". Error message shows " The instruction at "0x77fcaea0" referenced memory "some address", memory could not be written. Can somebody please help me in this? I am completely bugged with this error. I am not able to reproduce this error at my end. thanx in advacne, regards, Kavita

    I B D 4 Replies Last reply
    0
    • J jkav

      Hi There, I am getting error "Memory could not be written" only in release mode and that too not on my machine. I thought of using MAPinfo to get the line number/function call where application is crashing. Unfortunetly address shown in error message doesnt come close to addresses mentioned in my MAP file. I am very very confused, not getting any way to find this crash. My memory address in MAP file starts from "0x00400000" to "0x004002xxxx". Error message shows " The instruction at "0x77fcaea0" referenced memory "some address", memory could not be written. Can somebody please help me in this? I am completely bugged with this error. I am not able to reproduce this error at my end. thanx in advacne, regards, Kavita

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      I know it doesn't really help you, but the chances are you are giving a bad pointer to a function in a DLL. (Ie. every single Win32 API function). What you need is the stack of functions, so you can see the last function of yours to narrow things down. I'm sure there is an article or two here which may be able to help, but thats outside my realm! Iain.

      1 Reply Last reply
      0
      • J jkav

        Hi There, I am getting error "Memory could not be written" only in release mode and that too not on my machine. I thought of using MAPinfo to get the line number/function call where application is crashing. Unfortunetly address shown in error message doesnt come close to addresses mentioned in my MAP file. I am very very confused, not getting any way to find this crash. My memory address in MAP file starts from "0x00400000" to "0x004002xxxx". Error message shows " The instruction at "0x77fcaea0" referenced memory "some address", memory could not be written. Can somebody please help me in this? I am completely bugged with this error. I am not able to reproduce this error at my end. thanx in advacne, regards, Kavita

        B Offline
        B Offline
        badal_akr
        wrote on last edited by
        #3

        Hi, I guess you might be using the COM library. Because some time back i too had the same problem when i was using COM library. So what you need to do just go through the proper usage of the COM library and uninitialize it at some other place. Hopefully it should work Anil Anil Kumar

        1 Reply Last reply
        0
        • J jkav

          Hi There, I am getting error "Memory could not be written" only in release mode and that too not on my machine. I thought of using MAPinfo to get the line number/function call where application is crashing. Unfortunetly address shown in error message doesnt come close to addresses mentioned in my MAP file. I am very very confused, not getting any way to find this crash. My memory address in MAP file starts from "0x00400000" to "0x004002xxxx". Error message shows " The instruction at "0x77fcaea0" referenced memory "some address", memory could not be written. Can somebody please help me in this? I am completely bugged with this error. I am not able to reproduce this error at my end. thanx in advacne, regards, Kavita

          D Offline
          D Offline
          David Spain
          wrote on last edited by
          #4

          It could also be that you are using a pointer to a heap object, 'delete' was called on the pointer, and then this pointer variable was used again a few lines later in the code. The compiler would not catch this I don't believe, but may have given a warning in the compilation if the warning level was set high enough. Another thing that could be the cause is uninitialized memory. Release mode does not initialize the variables I believe. So you may be using a pointer somewhere that refers to a bogus address. You may already know this, but one thing you could do is to build it in release mode and run it on your machine, trying exactly what the user did, and see if it breaks for you also. If it does, then you know approximately where in the code it crashed and can look into the code to fix it. You have to run it in release mode, for the reason in the previous paragraph. In fact, for this same reason, one should always test in release mode before shipping. David Spain, C++ Applications Programmer

          1 Reply Last reply
          0
          • J jkav

            Hi There, I am getting error "Memory could not be written" only in release mode and that too not on my machine. I thought of using MAPinfo to get the line number/function call where application is crashing. Unfortunetly address shown in error message doesnt come close to addresses mentioned in my MAP file. I am very very confused, not getting any way to find this crash. My memory address in MAP file starts from "0x00400000" to "0x004002xxxx". Error message shows " The instruction at "0x77fcaea0" referenced memory "some address", memory could not be written. Can somebody please help me in this? I am completely bugged with this error. I am not able to reproduce this error at my end. thanx in advacne, regards, Kavita

            D Offline
            D Offline
            David Spain
            wrote on last edited by
            #5

            Also, about the addresses, they will most likely not be the same as what is on your machine, because it is the memory address used by that machine. These addresses could even differ between different 'runs' of the program. It would depend on where the user's operating system put the program in memory for that particular execution. So using the memory addresses to find the error will not work in this case. One more possibility, which you probably already know about, is that you could have written past the end of an allocated buffer. David Spain, C++ Applications Programmer

            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