Any work on cutting down the memory usage?

Something missing?
User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Any work on cutting down the memory usage?

Post by steffen » Fri 26. Mar 2010, 17:40

If you are not at the latest svn. version the factory might be set as a geometry attribute. In any case you should check that the geom factory is in fact gc'd. either use a reference queue or overwrite finalize and make a printout there. otherwise the test doesn't give much information...

Charles: can you please remove the setter for storing the factory in the geom? If we really need that it should be a static utilily method - but imho this should not be in the API.

STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Re: Any work on cutting down the memory usage?

Post by STRESS » Fri 26. Mar 2010, 18:38

Thanks Steffen, that's actually some crucial information I was missing. That would explain some behaviour I have been seeing before with non inlined arrays and indeed you are right the factory isn't gced. I can even see the reference in the mem profile hanging around.

However, in this particular case I don't think it should make a difference since it will just have another reference to the same double[] as DoubleDoubleArray.inlined and all it's parent classes upwards. Unless there is something else I am not aware of.

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Any work on cutting down the memory usage?

Post by steffen » Fri 26. Mar 2010, 18:47

no, the factory has (at least) one copy of the data... when you call factory.update() the data is copied into the geometry. it needs to be done this way to have consistant data and thread safety.

STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Re: Any work on cutting down the memory usage?

Post by STRESS » Fri 26. Mar 2010, 19:12

Aha thanks Steffen, yes removing the reference halfs the memory usage again :). Excellent! Well done! I am very happy now! :mrgreen:

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Any work on cutting down the memory usage?

Post by gunn » Fri 30. Apr 2010, 09:24

STRESS,

Just checking that this thread has been satisfactorily resolved.

1. What did you have to do to get the factory to be gc'ed?
2. Could you run the same statistics with jprofiler as in your post of March 26, on the current state? I would still be interested to know how much memory is used by the geometry w/o the factory hanging around. I think it's important if we can provide this information in the documentation, so users know what kind of overhead they have to expect.

Thanks.
jReality core developer

STRESS
Posts: 141
Joined: Mon 19. Jan 2009, 12:10

Re: Any work on cutting down the memory usage?

Post by STRESS » Tue 4. May 2010, 15:14

Hello gunn,

Thanks for your concern on this.
gunn wrote:STRESS,

Just checking that this thread has been satisfactorily resolved.
I am reasonable happy yes there is still room for further improvements but I am not so concerned right now.
1. What did you have to do to get the factory to be gc'ed?
The problem went away when I updated geometry or scene directory from the repository some of the AbstractSets holded a reference to the their factory that has recently been changed.

2. Could you run the same statistics with jprofiler as in your post of March 26, on the current state? I would still be interested to know how much memory is used by the geometry w/o the factory hanging around. I think it's important if we can provide this information in the documentation, so users know what kind of overhead they have to expect.

Thanks.
Sure that's what I'll get on a 1024x1024 now:

Total mem usage: 193Mbyte

Top three:

1. de.jreality.scene.data.DoubleArray 81Mbytes
2. double[] 57Mbytes
3. int[] 41Mbytes

So as you can see you still could avoid DoubleArray which is now the largest memory holder since that is just used as a caching structure with reformated layout if I understood the code correctly and I made a change once in PointSet which made it disappear while playing around but in the end I couldn't be bothered.

Post Reply