Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

"Memory could not be read 0x0594c340"

In regards to the post below: I mistakenly posted this as a reply to another issue that I thought was the same as mine. I know now that it isn't so I'm putting it here as a separate thread. Frank Moebius responded to the problem (in quotes) which I've reproduced at the very end of this post.

What follows immediately below is my response to his question/idea:

I am using .NET, but given that this problem started with the installation of Business One 2005, I'm guessing that it is not a GC issue. I know very little about GC, but my oCompany.Disconnect is on my form closing event handler, so I issued a "gc.collect" (vb) right below the disconnect and through debugging I can see that this procedure runs successfully. The memory error pops up later. I don't know if this proves anything, but I hope it helps. Every program we have is crashing when it is ended!

Thanks Again

Original Message:

"Hi Frank,

I can be more specific about the memory problem (or at least one that sounds exactly like the one reported).

We just upgraded to 2005 and I'm using the new DLL.

I have only a few programs and I went in and changed them to use the new DLL.

Most of them go to sbo-common for the db list & let the user select one.

If they connect to a DB then every thing is fine until they end the program and then I get a message that says "Memory could not be read (it lists this address: 0x0594c340).

If you don't connect to a DB then just end the program, it doesn't blow up.

I've written a new program too and the same thing happens.

Very troublesome for users.

I am issuing ocompany.disconnect before closing (debugged this & it goes past this line of code and the error occurs later)."

Former Member
Former Member replied

DOH! I am embarrassed because I did get an answer (a work around) from SAP & forgot to pass it on. It has solved my problem and is quite simple.

        'oCompany.Disconnect()
        System.Runtime.InteropServices.Marshal.ReleaseComObject(oCompany)
        oCompany = Nothing

Notice - when terminating your add on, DON't do ocompany.disconnect & DO set ocompany to nothing. I left the ReleaseComObject in there (which I tried before I got the answer) but I don'tknow if it's necessary or even a good idea.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question