Bug 1377 - Memory leak in ORB_init ()
Summary: Memory leak in ORB_init ()
Status: RESOLVED DUPLICATE of bug 846
Alias: None
Product: TAO
Classification: Unclassified
Component: ORB (show other bugs)
Version: 1.2.6
Hardware: All All
: P3 normal
Assignee: DOC Center Support List (internal)
URL:
Depends on: 846
Blocks: 1277
  Show dependency tree
 
Reported: 2002-11-25 23:10 CST by Nanbor Wang
Modified: 2002-12-09 16:03 CST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nanbor Wang 2002-11-25 23:10:29 CST
Following is the bug report from  Mogen

--------------- Cut here ------------------------------------
>>     TAO VERSION: 1.2.6
>>     ACE VERSION: 5.2.6
>>
>>     HOST MACHINE and OPERATING SYSTEM: Microsoft Windows XP Professional
>>
>>     TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
>>     COMPILER NAME AND VERSION (AND PATCHLEVEL): Borland C++Builder V6.0
>> Professional, Patch 2
>>
>>     AREA/CLASS/EXAMPLE AFFECTED:
>> [What example failed?  What module failed to compile?]
>>
>>     DOES THE PROBLEM AFFECT:
>>         EXECUTION?
>>
>> CORBA::ORB_init leaks memory.
>>
>>
>>     SYNOPSIS:
>> Borland CodeGuard reports that, CORBA::ORB_init leaks one block of memory
>>
>>
>>     DESCRIPTION:
>> When a simple program, which only initialize the ORB with CORBA::ORB_init, a
>> TAO_TSS_Resource object is leaked
>>
>>     REPEAT BY:
>>
>> Compile ACE/TAO and the following code with CodeGuard enabled (requieres
>> C++Builder Professional er Enterprise):
>>
>> <code>
>>
>> #include <corba.h>
>>
>> int main(int argc, char* argv[])
>> {
>>    // Initialize CORBA
>>    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
>>
>>    return 0;
>> }
>>
>>
>> </code>
>>
>>
>>
>> Run the application, and watch the CodeGuard report:
>>
>> <CodeGuard report>
>>
>> Error 00067. 0x300010 (Thread 0x0A64):
>> Resource leak: The object (0x131E880) was never deleted
>>
>> The object (0x0131E880) [size: 116 bytes] was created with new
>> Call Tree:
>>    0x006D4E3B(=TAO_BD.DLL:0x01:003E3B) \ACE_wrappers\ace/Synch_T.cpp#268
>>    0x006D2002(=TAO_BD.DLL:0x01:001002) \ACE_wrappers\ace/Synch_T.cpp#418
>>    0x006D1F52(=TAO_BD.DLL:0x01:000F52) \ACE_wrappers\ace/Synch_T.cpp#259
>>    0x006D1ACA(=TAO_BD.DLL:0x01:000ACA)
>> \ACE_wrappers\TAO\tao/TAO_Singleton.cpp#198
>>    0x007D9B2D(=TAO_BD.DLL:0x01:108B2D)
>> C:\ACE_wrappers\TAO\tao\ORB_Core.cpp#72
>>    0x007CA573(=TAO_BD.DLL:0x01:0F9573) C:\ACE_wrappers\TAO\tao\ORB.cpp#1356
>>
>> </CodeGuard report>
>>
>> which correspond to a call-stack:
>>    ACE_TSS<TAO_TSS_Resources>::make_TSS_TYPE()
>>    ACE_TSS<TAO_TSS_Resources>::ts_get()
>>    ACE_TSS<TAO_TSS_Resources>::operator TAO_TSS_Resources* ()
>>    TAO_TSS_Singleton<TAO_TSS_Resource, ACE_Thread_Mutex>::instance()
>>    TAO_default_environment()
>>    CORBA::ORB_init(int&, char **, const char*)
>>
>> The same program does not leak, if TAO 1.2.0 is used
>>
>>
>>     SAMPLE FIX/WORKAROUND:
>> Create the CORBA_Environment explicit, instead af using
>> TAO_default_environment.
>>
>> Change the function CORBA::ORB_init, line 1345 in file $TAO_ROO\tao\ORB.cpp,
>> from
>>
>>
>>   return CORBA::ORB_init (argc,
>>                           argv,
>>                           orb_name,
>>                           TAO_default_environment ());
>>
>> to
>>
>>   CORBA_Environment     env;
>>   return CORBA::ORB_init (argc,
>>                           argv,
>>                           orb_name,
>>                           env);
>>
>>
>>
>>
>>
>> Kind regards
>>
>> Mogens Hansen
>>
>>
------------------- Cut Here ------------------------------------------

Here is Ossama's reply to the above one

--------------- Cut Here --------------------------------------
There used to be leak there but I fixed it quite some time ago.  In
fact, Mogens reported the problem:

Wed May 16 21:28:22 2001  Ossama Othman  <ossama@uci.edu>

        * tao/ORB.cpp (ORB_init):

          Make sure the TAO_Singleton_Manager is initialized in the
          ORB_init() method that doesn't accept a CORBA::Environment()
          argument.  This fixes a memory leak that occured due to the
...
AFAICT, none of the code in question changed.  I don't believe that
the TAO_Singleton_Manager changed all that much either.

In any case, I don't think we can apply this since it breaks things
for applications that retrieve exception information from the default
CORBA::Environment() in TSS.

If there is indeed a leak, I'd prefer to figure out the actual cause
of the problem instead of work around it.

--------------- Cut here --------------------------------------

Needs invesigation before 1.3/1.3.1
Comment 1 Carlos O'Ryan 2002-12-08 13:58:26 CST
This one looks very similar to bug 846, in fact it may be a duplicate.
Comment 2 Carlos O'Ryan 2002-12-08 14:12:22 CST
Second read, it is basically the same issue.
Comment 3 Nanbor Wang 2002-12-09 16:03:07 CST
Marking it as a duplicate of 846

*** This bug has been marked as a duplicate of 846 ***