Referenced memory error in VB 2005 Express  
Author Message
Phil Pownall





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

I am running a small example application in VB 2005 Express and I get a referenced memory error when I close the application.  I do not get this error when I run the application from within the visual environment, only when I build and run the application as an EXE.  Also, I can run the application with no problem in VB 5 - from within the visual environment or as an EXE.  So how do I debug referenced memory errors

The exact error message is:
The instruction at "0x7c901010" referenced memory at "0x00000014".  The memory could not be "read".

Click on OK to terminate the program.





Visual Studio Express Editions21  
 
 
Phil RCM





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

I also have the same (similar) error message:

Tittle of error message window is: "Explorer.EXE - Application Error"

The instruction at "0x7c901010" referenced memory at "0x00000080", The memory could not be "read".

This error message appears at start-up. I have Windows XP.

The only major change I made to my system before this error message occured is that I installed Symantec Antivirus software from a corporate licence version.

Any idea on how to prevent this error message from occuring again

Thanks.


 
 
richard1866





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

I am having the same error code as above can someone help thanks.

The instruction at "0x7c901010" referenced memory at "0x00000001", The memory could not be "read".

what is this code linked to


 
 
Chirag Rai





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

The instruction at "0x7c901010" referenced memory at "0x00000001", The memory could not be "read

Please let me know anybody who can solve this problem as soon as possible



 
 
ReneeC





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

We don't even know what classes you are using. we haven't seen any code.

Are you using AXbrowser



 
 
BenKC





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top


I oso get the similar error when running my app exe file which created using VB6

The instruction at "00x734a3fea" referenced memory at "0x00000014", the memory could not be read.

Press OK to terminate the program.

may I know what is this error means how can I get this error


 
 
starguide





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

I have also had the same problem with Visual Studio 2005 Express - this only occurred once a reference to a third party activex control (in my case, vbSendMail.dll) had been made - and the error did not occur if this had not been used, or the application was run from the IDE.

The dll is registered, and the email did send successfully, and showed no signs of error - it's only when I closed the application that it threw the memory error. No errors appear on the VS error list during debugging, and publishing the application was perfectly successful.

I'm trying to work out how to fix the problem, so if anyone has an answer or suggestion, it would be most appreciated!

Thanks in advance


 
 
ReneeC





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

I was an engineer developing a different OS than windows. As part of the system design, we made the very first page of memory a blackhole page, deliberately making it unreadable. I'm not sure if Windows has done this or not but it sure appears that way.

You don't want to prevent that error. You want that error because it's telling you that something else is wrong. When you see an error that says I can't read address four****, what's really occuring is that there is a pointer that is not being filled and the machine is attempting to read an address four**** bytes off of the pointer. If the first page was readable, then your program would pick up garbage and not know and it could do some real damage. That's why good operating systems deliberately make the first page unreadable.

So the real question is why there appear to be pointers that are not being filled or are being corrupted What are these applications doing Are they using interop or COM API's



 
 
starguide





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

Hi ReneeC, thanks for your reply!

My own application is using a COM object (which Visual Studio - Visual Basic Express converts to an Interop). It's a third party dll which I have no control over the code for, so I was hoping that this is something that I'm doing rather than the dll - but the error only occurs when I use the object (clsSendMail) in the dll.

As I'm sure you're aware, Visual Basic .NET doesn't use pointers in the same way that c++ does, or at least, they're not exposed to the developer. Since Visual Studio effectively manages its own garbage disposal in terms of memory, I've removed any of my own attempts, in order to see if I can stop it doing this - to no avail.

I've used the dll in VBA before, with no problems, hence my guess that it's either me, or Visual Studio Express' garbage collection, that appears to be the source of the problem!

The application pretty much consists of a set of text boxes, command buttons and a listview, which has a background array which holds some details which I want hidden, and two user-defined types which populate the listview from the array. These details do not cause a problem when populating and then closing the published application.

It's only when I click the 'Submit' button, which reads the information out to an HTML email, and sends it off to another user for processing, by way of the vbSendMail dll. Once this has run, when you try to close the application, it triggers that message - but I (so far) haven't been able to work out why.


 
 
ReneeC





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

Hi Starguide,

"As I'm sure you're aware, Visual Basic .NET doesn't use pointers in the same way that c++ does, or at least, they're not exposed to the developer. "

It's definitely the latter and not the former. No computer language could work efficiently without pointers. The machine code that VB.Net produces in memory is indistguishable from C++ code.

VBA is COM and VBA won't have any trouble with a COM DLL nor will VB5 or VB6 but it's more of an art with .Net. You're right about gargage collection and one of the main differences between COM and VB.Net is that the two memory management system seem and feel as if they are two entirely different systems. They are allocated and deallocated very differently.

Could we see some code

How are you instantiating the COM object Have you single stepped through the code. Have you changed Long references to Integer references



 
 
starguide





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

The only code that interacts with the dll is below. Single-stepping through the code highlights no problems - the error occurs after the program has ended, during what I assume is the garbage handling stuff generated by visual studio.

Code Block

Function SendHTMLMessage(ByVal ToAddress As String, _

ByVal ToName As String, _

ByVal CCToAddress As String, _

ByVal CCToName As String, _

ByVal Attachment As String, _

ByVal MessageBody As String, _

ByVal RequestID As String, _

Optional ByVal Bcc As Boolean = False) As Boolean

Dim poSendMail As New clsSendMail

With poSendMail

.SMTPHost = My.Settings.ixlEmailServerIP 'MailServerIP

.from = My.Settings.ixlMailFromAddress

.FromDisplayName = My.Settings.ixlMailFromName

.Recipient = ToAddress

.RecipientDisplayName = ToName

.CcRecipient = CCToAddress

.CcDisplayName = CCToName

If My.Settings.ixlBCC_YN Then

.BccRecipient = My.Settings.ixlBCCRecipient '

End If

.ReplyToAddress = CCToAddress

.Subject = "IXL Purchase Order Requisition " & RequestID

.Message = MessageBody & HTMLSignature()

.Attachment = Attachment & ";" & ExtractFilePath(My.Settings.ixlSendFileName) & RequestID

.AsHTML = True

SendHTMLMessage = .Ping(MailServerIP)

.Send()

poSendMail = Nothing

End With

End Function

My only assumption has been that the problem is likely to be in the dll, rather than my own code, as there's nothing in there that causes a problem - to support this, when I comment out the email section, it runs fine.

The only way I can see to avoid this, is to switch to SMTP within my own code.

This one (with the same dll) also appears to have been logged before (http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx FeedbackID=90006)


 
 
ReneeC





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

Well I'm confused about something. System.Net has classes for sending email. Whay aren't you using those

 
 
starguide





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

Because everyone's a learner sometime.

 
 
ReneeC





PostPosted: Visual Basic Express Edition, Referenced memory error in VB 2005 Express Top

I get that Starguide, but somethings are more valuable than others. You are talking COM here and I believe that's a very outdated technology and not one the .Net always gets along with.

Given that there are so many things to learn... why pick such a sub-optimal one.