J
Jason Cavett
I am currently in the process of using a BlockingQueue
(LinkedBlockingQueue, to be exact) to help with a producer/consumer
aspect of an application I'm developing. The user can continuously
add items to the queue for processing (and this does work). However,
I'm a little confused about how a BlockingQueue works.
When I add an item to the BlockingQueue, is the items copied into the
queue, or is it just a reference to the actual object?
The reason I ask is because I notice that after adding 9 to 11 items
into the queue, the application slows considerably (despite the fact
that the "queue" stuff is running in a separate thread). After
watching the output from the garbage collector, it appears as though I
have a memory leak. I attempted to use hprof to profile my
application to see where the memory leak is taking place, but I'm not
fully understanding the output of hprof. When my application lags
like this, it somewaht defeats the purpose of the use of the
BlockingQueue since I want users to be able to queue up files to
process.
Can anybody clear up any possible issues or provide some insight with
the way BlockingQueue works and any possible memory issues I should be
keeping an eye out for (there isn't much information that I could find
from my own Google searches).
Thanks
(LinkedBlockingQueue, to be exact) to help with a producer/consumer
aspect of an application I'm developing. The user can continuously
add items to the queue for processing (and this does work). However,
I'm a little confused about how a BlockingQueue works.
When I add an item to the BlockingQueue, is the items copied into the
queue, or is it just a reference to the actual object?
The reason I ask is because I notice that after adding 9 to 11 items
into the queue, the application slows considerably (despite the fact
that the "queue" stuff is running in a separate thread). After
watching the output from the garbage collector, it appears as though I
have a memory leak. I attempted to use hprof to profile my
application to see where the memory leak is taking place, but I'm not
fully understanding the output of hprof. When my application lags
like this, it somewaht defeats the purpose of the use of the
BlockingQueue since I want users to be able to queue up files to
process.
Can anybody clear up any possible issues or provide some insight with
the way BlockingQueue works and any possible memory issues I should be
keeping an eye out for (there isn't much information that I could find
from my own Google searches).
Thanks