110-160mb mem usage??

Started by 9kaywun, October 24, 2012, 02:19:05 AM

Previous topic - Next topic

9kaywun

I've been working on a multiplayer game using jPCT for quite some time now.. and it's been a very long work in progress. Lately I've done a full client/protocol optimization because I have an ETA set in December to publish it on my website. This is the most time consuming and long term application I have probably developed, and no code should be considered unstable or not efficient.

To the point here.. I am not sure why, but I cannot get memory usage to a satisfying level. Are there any common jPCT high memory solution techniques? So far my game consists of a plane, 5 animated npcs, a local player, and a 2nd user connected for most testing, and even when it's only the local player I have this issue.

Another note: Frames per second is between 55-60 usually, but memory is still way up there..

Edit: I ran VisualVM and apparently 117mb of memory is being used by int[] (has to be jPCT, maybe I am not doing something as intended, ie: vector usage?)

Edit 2: Even the login state (no world/object3d instances, just 2 and 4 lines of text) has the same issue with memory usage.
Developing a 3D multiplayer engine using jPCT:
Deleted, will return soon..

EgonOlsen

I somehow fail to see the actual issue here...how much of the ~150mb do the actual int[]s consume? And how much is overhead caused by the VM itself? You have to keep in mind that the VM will always reserve/consume quite a few MBs for it's own purpose. 150mb isn't much for todays machines and not a problem by itself IMHO.
Anyway, the only int[]-array in existence before creating a world/objects is the one used by the FrameBuffer to backup the screen. You might want to log memory usage before and after creating that buffer to see if that's causing it.
Apart from that, you can do different things on the object level:


9kaywun

#2

Pic^

Compression not necessary as I am using MD2 format models, stripping makes the entities not visible, and max polys visible is only 9000 at the moment.

When I force a garbage collection using VisualVM, memory drops to 80-90mb.. Then climbs at bounces around at 120-140mb.

Also, out of curiosity I tried this.. and if I stick Runtime.getRuntime().gc() into my fps check (called every 1000ms) it stays between 79-90mb.. I never call a gc request in a cycle, but in this case it seems to help dramatically.

Thoughts?
Developing a 3D multiplayer engine using jPCT:
Deleted, will return soon..

EgonOlsen

Quote from: 9kaywun on October 24, 2012, 10:18:33 AM
Thoughts?
Yes, don't bother with it. The VM manages it's memory on its own and calls the gc whenever it thinks it has to. There's no point in calling gc by yourself just to free some of the VMs internal memory. The VM reserves memory to use it and there's no need to worry about that it actually does.

9kaywun

Developing a 3D multiplayer engine using jPCT:
Deleted, will return soon..