[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jacorb-developer
Subject:    [jacorb-developer] Issues with Jacorb Bug Fix (ID: 835)
From:       "SINGH, ABHISHEK (ABHISHEK)" <asi () alcatel-lucent ! com>
Date:       2009-08-27 7:16:08
Message-ID: A9D7AD013754D14182A445BAACFF46D709FDAA8FDA () INBANSXCHMBSA2 ! in ! alcatel-lucent ! com
[Download RAW message or body]

Hi All,

I have found an issue with the fix proposed for the Jacorb Bug \
http://www.jacorb.org/cgi-bin/bugzilla/show_bug.cgi?id=835.

The method org.jacorb.naming.BindingIteratorImpl.destroy() is not called from \
anywhere. This might again lead to a memory leak scenario in NameService, when you \
call the NamingContextExt.list method too much times.

The list method of ContextLister which is used by lsns calls the \
NamingContextExt.list recursively for each of the sub context and when you have a \
large number of contexts in Naming service, we can end up in such a scenario.

So even if we have this fix, we get memory leaks. In addition to the proposed fix, we \
should call org.jacorb.naming.BindingIteratorImpl.destroy() in a finally block in \
ContextLister .list( NamingContextExt n, String indent, java.io.PrintStream ps )

The code snippet is as follows:

org.jacorb.naming.ContextLister .list( NamingContextExt n, String indent, \
                java.io.PrintStream ps )
---------------------------------------------------------------------------------------------------


 mark(n);

        BindingListHolder blsoh =  new BindingListHolder(new Binding[0]);

        BindingIteratorHolder bioh = new BindingIteratorHolder();

        try
        {
            n.list( 0, blsoh, bioh );

            BindingHolder bh = new BindingHolder();

            if( bioh.value == null )
                return;

            while( bioh.value.next_one( bh ))
            {
                String stringName = root_context.to_string( bh.value.binding_name);
                ps.print( indent + stringName );
                if( bh.value.binding_type.value() == BindingType._ncontext )
                {
                    String _indent = indent + "\t";
                    ps.println("/");

                    NameComponent [] name = root_context.to_name(stringName);
                    NamingContextExt sub_context =
                        NamingContextExtHelper.narrow( n.resolve(name) );
                    list( sub_context, _indent, ps );
                }
                else
                    System.out.println();
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
             bioh.value.destroy();
        }

Regards,
Abhishek Singh
_______________________________________________
jacorb-developer maillist  -  jacorb-developer@lists.spline.inf.fu-berlin.de
https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic