Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid memory access of location in Java

Tags:

java

jvm

I've been working on a Java project for year. My code had been working fine for months. A few days ago I upgraded the Java SDK to the newest version 1.6.0_26 on my Mac (Snow Leopard 10.6.8). After the upgrade, something very weird happens. When I run some of the classes, I get this error:

Invalid memory access of location 0x202 rip=0x202

But, if I run them with -Xint (interpreted) they work, slow but work fine. I get that problem in classes where I use bitwise operators (bitboards for the game Othello). I can't put any code here because I don't get an error, exception or something similar. I just get that annoying message.

Is it normal that the code doesn't run without -Xint but it works with it? What should I do?

Thanks in advance

like image 349
David Robles Avatar asked Jul 03 '11 03:07

David Robles


People also ask

What does invalid memory location mean?

Invalid access to memory location error occurs when the system is unable to process through the driver. It can also appear when your ram is not accessible or the other application uses memory location. Outdated graphics driver and outdated Windows seemed to be the main cause for this error.

How do I fix invalid memory location?

The “Invalid access to memory location" error typically occurs when the game is unable to access enough RAM. Make sure that you close any unnecessary programs when playing Valorant. If you run into the error, simply restart your computer and launch Valorant again.


2 Answers

When a JVM starts crashing like that, it is a sign that something has broken the JVM's execution model.

Does your application include any native code? Does it use any 3rd-party libraries with native code components? If neither is true, then the chances are that this is a bug in the Apple port of the JVM. It could be a JIT compiler bug, or a bug in some JVM native code library.

What can you do about a bug like that?

Not a lot.

  • Reduce your application by progressively chopping out bits until you have a small testcase that exhibits the problem.
  • Based on the testcase, see if there's some empirical way to avoid the problem.
  • Submit a bug report to Apple with the testcase.
like image 169
Stephen C Avatar answered Oct 20 '22 01:10

Stephen C


I just came across this situation and it turned out to be related to a piece of code that was serializing a JSON object with a cyclic reference to itself. I removed the cycle and the error went away. I suspect this is related to a memory overflow error that is now handled differently by newer JVMs on Mac OSX. In this case, I was running Mac OSX 10.7.

For completeness the errors I was receiving were:

Invalid access of stack red zone 0x10e586d30 rip=0x10daabba6
Bus error: 10

And:

Invalid memory access of location 0x10b655890 rip=0x10a8baba6
Segmentation fault: 11
like image 38
Michael Gaylord Avatar answered Oct 20 '22 01:10

Michael Gaylord