VMD crashes with too many class definitions (Will be fixed in next update!)
Posted: Sun Jul 23, 2023 10:10 am
Hey, I just ran into a strange issue. Never saw this before, but I can easily reproduce it, and I'm wondering if this is something I have misconfigured in my system and/or something really obvious I'm missing.
Simply put, VMD crashes if there are "too many" class definitions in the code. It feels like "something" hits some limit and causes the crash. AFAIK, it's not a limitation of Java, but something else is happening here.
To reproduce, just open a new fresh VMD project, and add class definitions in the code under "Add your own variables and functions here". Empty dummy classes do the trick just fine. Like so:
When I do this and get to about 90-95 classes (the exact number seems to vary a little, for some reason), the code still compiles and starts running, the module window appears, then suddenly disappears, and I get the OS X crash report window (the report is attached). VMD still thinks the module is running, so I need to select "Stop running" from the menu. Removing a class or two makes the program work again.
A few points:
- This is not about too many class _instances_. Just adding class definitions is enough.
- The actual contents of the class does not seem to matter, an empty dummy class does the trick.
- As far as I can understand, the error happens somewhere between compiling and actually running the code. It happens with a new default project with no user code, except class definitions.
- It also doesn't seem to matter if the class definitions are in the main .java file or other files - if the total is "too much", it's crash boom bang. Enums and anonymous classes are also counted in the total.
I'm working on a pretty big module with lots of classes and enums, and I hit the limit "naturally", and it took me a while to figure out what is happening.
Can anyone else reproduce this, and any ideas how to get around it? Thanks!
Simply put, VMD crashes if there are "too many" class definitions in the code. It feels like "something" hits some limit and causes the crash. AFAIK, it's not a limitation of Java, but something else is happening here.
To reproduce, just open a new fresh VMD project, and add class definitions in the code under "Add your own variables and functions here". Empty dummy classes do the trick just fine. Like so:
Code: Select all
class Test1 {}
class Test2 {}
class Test3 {}
...
A few points:
- This is not about too many class _instances_. Just adding class definitions is enough.
- The actual contents of the class does not seem to matter, an empty dummy class does the trick.
- As far as I can understand, the error happens somewhere between compiling and actually running the code. It happens with a new default project with no user code, except class definitions.
- It also doesn't seem to matter if the class definitions are in the main .java file or other files - if the total is "too much", it's crash boom bang. Enums and anonymous classes are also counted in the total.
I'm working on a pretty big module with lots of classes and enums, and I hit the limit "naturally", and it took me a while to figure out what is happening.
Can anyone else reproduce this, and any ideas how to get around it? Thanks!