Author Topic: Streaming algorithm  (Read 10277 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Streaming algorithm
« Reply #15 on: May 14, 2006, 11:39:22 pm »
Quote from: "raft"
what i was trying to say that i'm not sure if java spec dictates to perform a complete garbage collection if no memory is available, does it ?
As fas as i know, i doesn't even dictate a garbage collection at all, i.e. you could write a VM according to the specs that doesn't do any garbage collection (as pointless as such a VM would be). The SUN-VM should perform a complete collection before throwing an out of memory. Everything else would be just plain stupid.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Streaming algorithm
« Reply #16 on: May 15, 2006, 01:16:10 am »
ehm, so i have an un-generatable memory leak somewhere, thanks for the gift :roll:
Code: [Select]
r a f t

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Streaming algorithm
« Reply #17 on: May 15, 2006, 05:49:36 pm »
later, i've remembered an article i read about garbage collection stuff. here is a part from it:

Quote
One case where a finalize method delayed GC was discovered by the quality assurance (QA) team working on Swing. The QA team created a stress testing application that simulated user input by using a thread to send artificial events to the GUI. Running on one version of the toolkit, the application reported an OutOfMemoryError after just a few minutes of testing. The problem was finally traced back to the fact that the thread sending the events was running at a higher priority than the finalizer thread. The program ran out of memory because about 10,000 Graphics objects were held in the finalizer queue waiting for a chance to run their finalizers.


i do not have any finalizers and jpct neither has as far as i know. on the other hand this writing means that one can have an OutOfMemoryError even if there are some objects waiting to be collected

plain stupid ? yeah, kind of :roll:

for the curious here is the article by sun: http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html

Quote
r a f t

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Streaming algorithm
« Reply #18 on: May 15, 2006, 08:01:15 pm »
Just great... :?

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
Streaming algorithm
« Reply #19 on: May 16, 2006, 12:24:25 pm »
Try increasing heap size with -Xmx / -Xms params to jvm. If it works fine then:
 - leave as is, update memory requirements ;)
 - review you code for possible optimizations that will reduce memory usage

If not, then you may say you've got a memory leak. You will have to review the code / launch application under profiler to discover the problem. From the past experience the problem is most likely that there are references to "obsolete" objects stored inside your "active" objects in a running threads:

- in object's properties
- in hashmaps/collections (caches, "listeners", etc.)
- in another thread, that is still alive (daemons, launching actions in new thread)
- non-static inner classes - they still carry a reference to outer class instance
- AWT/Swing elements. They might have your objects in model/listeners
- double check static objects - 90% of problems go there

If i were you, I'd use JProfiler (it's commercial but you may find a workarond at astalavista.box.sk if you need it badly) and it's memory monitor to find out more about memory usage in your application.
Regards,
Andrei

Offline eye1

  • int
  • **
  • Posts: 68
    • View Profile
Streaming algorithm
« Reply #20 on: December 11, 2006, 05:47:24 pm »
Quote from: "radvani7"

The custom scaling worked out very well; I just multiplied a single-axis scale matrix with the rotation matrix, and set that composite matrix as the Object's rotation matrix.

Since I don't use the build-in scaling it doesn't cause any problems there!


Hm.. Don't really know how to do that  :? ...