scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
67 stars 17 forks source link

Don't use Java NIO direct memory for mesh storage #135

Closed skalarproduktraum closed 1 year ago

skalarproduktraum commented 6 years ago

We should use e.g. jemalloc for allocating mesh storage, as for large meshes, the JVM will run out of memory.

ctrueden commented 6 years ago

I thought that direct memory didn't count toward the JVM heap limit?

skalarproduktraum commented 5 years ago

Not towards the heap limit, but there's an additional limit for direct buffers: https://stackoverflow.com/questions/3773775/default-for-xxmaxdirectmemorysize

ctrueden commented 5 years ago

@skalarproduktraum Wow, that is so weird. Normally, I'd point out that using jemalloc would be less cross-platform than using direct memory, and therefore to be avoided... but since scenery and sciview are already tied down platform-wise, I guess the benefits outweigh the disadvantages. Do you ever expect to support any platforms other than Windows, MacOS and Linux? In particular, will Scenery work on Raspberry Pi? Will jemalloc? People have specifically asked about Fiji + 3D viz on Pi in the past with Java 3D; see here for a short summary of (lack of) known status there. It would be a shame if our next-generation 3D viz solution still can't do it.

skalarproduktraum commented 5 years ago

There's no reason jemalloc shouldn't work on ARM. That being said, lwjgl at the moment is x64-only. Regarding the memory allocators, jemalloc is also just one option in lwjgl, an the system allocator can always be used as a fallback, it's just that jemalloc is usually much more efficient.

kephale commented 5 years ago

This might be relevant to imagej-mesh as well.

kephale commented 5 years ago

Partially addressed in https://github.com/scenerygraphics/sciview/commit/e4031b253cb103c1d9fd7b73789c0321350326cb

Waiting on https://github.com/scenerygraphics/scenery/issues/243

kephale commented 1 year ago

I believe this is more or less resolved.