jMonkeyEngine / jMonkeyEngine/jmonkeyengine
PROPERTY_BUFFER_ALLOCATOR_IMPLEMENTATION set by LwjglContext gets ignored sometimes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
Hi
LwjglContext (in jme3-lwjgl3 module) specifies its own implementation of buffer allocator to be used by BufferAllocatorFactory by setting PROPERTY_BUFFER_ALLOCATOR_IMPLEMENTATION property in this static code block:
the issue is that sometimes this property gets ignored by BufferAllocatorFactory and a ReflectionAllocator is created instead. That is because BufferAllocatorFactory.create() method sometimes is called before the LwjglContext sets the new property. Inside the BufferUtils class:
Sometimes the order of these static executions is different, e.g the one in the BufferUtils runs before the LwjglContext, which will cause BufferAllocator allocator to get initialized with Reflectionallocator and bypass the LWJGL3 allocator.
Edit:
2 possible fixes are suggested for this issue:
https://github.com/jMonkeyEngine/jmonkeyengine/issues/1674#issuecomment-1086843067
and:
https://github.com/jMonkeyEngine/jmonkeyengine/issues/1674#issuecomment-1129832078
Edit2:
Forum topic:
https://hub.jmonkeyengine.org/t/buffer-allocator-implementation-set-by-lwjglcontext-gets-ignored-sometimes/45594
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the static initialization in jme3-core/src/main/java/com/jme3/util/BufferUtils.java and BufferAllocatorFactory.create(), then compare it with the property setup in jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java. Investigate the two proposed fixes linked from issue #1674 and verify that the LWJGL3 allocator is selected regardless of static initialization order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100