Instruction at "0x00000001" referenced memory at "0x00000001". The memory could not be "read".

This is the error that I get when I try to compile my project.

Instruction at "0x00000001" referenced memory at "0x00000001". The memory could not be "read".

Then when I hit OK, it gives the following additional messagebox.

The instruction at "0x76338dc9" referenced memory at "0x0000009c". The memory could not be "written".

The title of both messages boxes is:
VB6.EXE  - Application Error.

I copied the entire directory to a different location and get the same message.

When I copied the files, I noticed many .OBJ files with the description "Intermediate File" - I imagine that this is what VB was using to build the exe when I tried to compile it.

Points are not an issue - I need help!!
Who is Participating?
LunchyConnect With a Mentor Commented:
Is this problem occurs when you compile the project to exe Are you able to run the application with the option "Start with Full compile" from Run menu.

If VB6 throws exception while building to exe , it is problem with your VB installation. Try reinstalling VB
Valliappan ANSenior Tech ConsultantCommented:
Check your RAM also. To check for, you could try compiling your project in another VB installed system.

yes, OBJ files are created by VB when compiling takes place.

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Éric MoreauSenior .Net ConsultantCommented:
Do you have plenty of free space on your TEMP drive?

Is there any files with the ReadOnly attributes set?
Try setting your project options to compile using p-code rather than N-code and see if it works or not.

Another method would be to close any VB applications including VB6., go to your temp drive and delete all the VB****.TMp files even if their attributes are read-only (which is usually the case).  Then, run VB and compile the whole thingy.  (This may not help anything at all.)

Could it also be that your vbp file was corrupted somehow?  Create a new vbp (project) file and include all the *.frm and *.bas (and whatever that you've used) files and try running the whole thing again.

The last resort would be to renstall VB6.

That's it!

glass cookie : )
i got that a lot on a w2k machine.  I tried everything I could think of to fix it including reinstalling vb. nothing worked.  I finally redid the cpu and it fixed it.  now I am on a different cpu.  I haven't had any of the compile errors, but ever once and a while i get the error when closing a project.
wileecoyAuthor Commented:
I am using w2k.

After posting this message, I created a new project and added all the forms from the old project.  That didn't work.

I will try the other suggestions and see if I get anywhere.

Thanks for the help!
wileecoyAuthor Commented:
Ok - I have completed testing:

None of the following worked -

1. I WAS, yes was able to run the app with - "Start with Full compile"
2. Clear Temp Drive (WinNT\Temp on w2k)
3. Enough memory - I have 256 MG, should be enough.
4. Read-Only files - the only ones were safesource - deleted.
5. I was able to compile other projects.
6. I was NOT able to compile to P-code.

I will try to reinstall VB, however, since I am able to complile other projects, this does not seem real promising.

jrspano - were you able to get it to work on w2k, if so - what exactly did you do?

Thanks again for the help.  This is (was) supposed to go on the market soon (... my ulcer is acting up).
Éric MoreauSenior .Net ConsultantCommented:
Add your forms and modules one after the other compiling between each to find which one gives you problem.
I redid the whole cpu from scratch. format drives and redo etc.  the project worked fine after that.  That should tell us that your project is ok.  You should be able to compile it on another cpu for the time being if you need the compiled object right now.
wileecoyAuthor Commented:

I did try doing that, however, I have forms that are dependent on modules and I get compile errors as functions and procedures aren't defined.  So, I wasn't able to specifically identify (without commenting out a LOT of code) if there was one form, module or class that was giving me the problems.

Also - One thing that I didn't consider.  I have McAfee Uninstaller.  Every 30 days it asks me if I want to clean up old temp file, cached internet files... etc.  Well - I did that a couple of days ago.  I usually don't (just been to lazy to reset the option to ask me to "no").  Maybe something happened there.  I am going to see if I can restore that.  A long-shot, but I'll try anything.

Also - I was just creating a new spreadsheet in Excel 2000.  I got a memory address error similar to the one I described above.  May not be VB at all, but may be my w2k or bad memory or hard drive or motherboard or ....

I'll keep posting progress.
wileecoyAuthor Commented:
Well - the McAfee Unistaller didn't work.

I was wondering, if I have the address, isn't there some way that I can identify what would be in that address?

I have c++ and spy++ and all that - isn't there some way to log an error of this type so I can try to hone in on the problem?
wileecoyAuthor Commented:
OK -

All is well.  I have found the problem.

fyi - if you are interested.

First - I re-istalled Visual Studio.  I couldn't figure out why my c++ wasn't allowing me to debug like it usually does.  Well - it allowed me to debug after I re-installed it.

So - I debugged VB6.exe - stepped through all of what looks like cryptic code to me.

I compiled the app and it told me what ocx was having the problem.

I removed the ocx from my application - everything is fine.

Spy++ didn't work, by the way.

So - I am going to split the points up evenly amoung all who responded as each comment was useful.

Please look for a question posted as 'For yourname - Instruction at "0x00000001" referenced memory at "0x00000001". The memory could not be "read".'

Thanks to all for the assistance.
what ocx was it?
wileecoyAuthor Commented:
rbutton.ocx - it was a custom control that I downloaded from a vb website.

It was unnecessary, and definately not worth the problem.
wileecoy, I also deleted a duplicate Q for jrspano.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.