[SNMP4J] DefaultUDPTransportMapping - java.lang.OutOfMemoryError

Frank Fock fock at agentpp.com
Thu Feb 26 01:26:23 CET 2009


Hi Mathew,

There is nothing to close or free
when using TreeUtils (except probably
the TreeUtils instance itself).
It does not create any threads and
does not hold any collections of
internal data.

I suspect, that "next(e)" is the
problem source...

Best regards,
Frank

Mathew Rowley wrote:
> When profiling an application which has a set of threads that use TreeUtils
> to SNMP walk.  No matter how many threads I use, I eventually get the
> following OOM exception:
> 
> java.lang.OutOfMemoryError: Java heap space
> Exception in thread "DefaultUDPTransportMapping_192.168.0.10/0"
> java.lang.OutOfMemoryError: Java heap space
> 
> Is there something I need to explicitly define in the TreeListener to close
> the thread when the walk has completed (besides notify())? Or is there
> something I need to do to clear the thread out of memory when its finished
> executing?
> It seems like the Object that is not being destroyed is:
> java.util.TreeMap$Entry
> This is what I currently have ­ any help would be appreciated.  Thanks.
> 
>     public void finished(TreeEvent e) {
>         if ((e.getVariableBindings() != null) &&
> (e.getVariableBindings().length > 0)) {
>             next(e);
>         }
>         
>         if (e.isError()) {
>             this.collector.increaseTotalCmtsErrors();
>             logger.error(new StringBuffer("There was an error during SNMP
> walk (").append(host).append("): ").append(e.getErrorMessage()).toString());
>         }
>         
>         // Let the collector know the thread has finished, and increase the
> total counter
>         collector.increaseTotalCmtsFinished();
>         collector.getFreeThreadsQueue().add(new Integer(threadIndex));
>         
>         // Show the thread has finished
>         synchronized(this) {
>             this.notify();
>         }
>     }
> 
>     public boolean next(TreeEvent e) {
>         String mac = getVariable(e);
>         
>         logger.debug(new StringBuffer("Adding to queue: ").append(mac));
>         this.collector.addMac(mac);
>         
>         return true;
>     }

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list