Search the web
Sign In
New User? Sign Up
ace-users
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
[ace-users] ACE_File_Lock -- memory not freed?   Message List  
Reply | Forward Message #42965 of 42992 |
Re: [ace-users] ACE_File_Lock -- memory not freed?

Hi Sandeep,

>> OS: RH EL (AS 3.0)
>> Hardware:
>> [root@CISCART27 sdi]# uname -a
>> Linux CISCART27 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17
>> 17:52:23 EDT 2005 i686 i686 i386 GNU/Linux
>> ACE lib version: 5.3.5

Wow, you are using a VERY old version of ACE. I recommend that you
upgrade to ACE+TAO x.4.7, which you can download from

http://deuce.doc.wustl.edu/Download.html

under the heading "latest beta kit". Things have changed quite a bit
since then, so I suspect this memory leak has been fixed. Please see

http://www.cs.wustl.edu/~schmidt/ACE_wrapers/ace/OS_NS_stdio.inl

to see the latest code.

Thanks,

Doug

>> We are using ACE_File_Lock in our application as
>> below.
>> ACE_File_Lock checkLock(LockFile, RDONLY,0,0);
>>
>> if (checkLock.tryacquire() !=3D -1) {
>> Printf("tryacquir failed");
>> return false;
>> }
>>
>> Here appl1Lock is actually created by some other
>> application & we want to check if that file is present
>> (which means that app is running).
>>
>> The application is working fine. But in some cases the
>> LockFile may not be actaully be there & hence we see
>> error like "ACE_File_LOck::ACE_File_Lock <name of
>> LockFile> no such file or directory", which is also
>> ok.
>>
>> But, when the application is run with valgrind(memory
>> leak checking tool), it reports that memory allocated
>> with strdup() in the constructor ACE_File_Lock is not
>> being freed for some cases.
>>
>> I looked at the ACE code. Though I did not look at it
>> thoroughly, I felt in our case memory allocated using
>> strdup in ACE_OS::flock_init() in
>> ACE_File_Lock()::open() is not being freed in
>> ACE_OS::flock_destory().
>>
>> >From OS.i file
>> ----------------------------------------------
>> #if defined (CHORUS)
>> // Are we the owner?
>> if (lock->process_lock_ && lock->lockname_ !=3D 0)
>> {
>> // Only destroy the lock if we're the owner
>> ACE_OS::mutex_destroy (lock->process_lock_);
>> ACE_OS::munmap (lock->process_lock_,
>> sizeof (ACE_mutex_t));
>> if (unlink_file)
>> ACE_OS::shm_unlink (lock->lockname_);
>> ACE_OS::free (ACE_static_cast (void *,
>>
>> ACE_const_cast (ACE_TCHAR *,
>>
>> lock->lockname_)));
>> }
>> else if (lock->process_lock_)
>> // Just unmap the memory.
>> ACE_OS::munmap (lock->process_lock_,
>> sizeof (ACE_mutex_t));
>> -----------------------------------------------
>>
>> I think in our case since we are not the owner of lock
>> file, lock->process_lock_ is not initialized and hence
>> memory allocated to lock->lockname is not freed.
>>
>> Please let me know if this is true.
>> Forgive me if I am wrong & explain how it works.

--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Institute for Software Integrated Systems WEB:
www.dre.vanderbilt.edu/~schmidt
Vanderbilt University, Nashville TN, 37203 NET: d.schmidt@...



Thu Oct 6, 2005 7:09 pm

schmidt@...
Send Email Send Email

Forward
Message #42965 of 42992 |
Expand Messages Author Sort by Date

Hi, OS: RH EL (AS 3.0) Hardware: [root@CISCART27 sdi]# uname -a Linux CISCART27 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17 17:52:23 EDT 2005 i686 i686 i386...
Sandeep Deshpande
sandeep.bvb@...
Send Email
Oct 5, 2005
5:24 am

Please read appl1Lock as LockFile. Thanks, Sandeep...
Sandeep Deshpande
sandeep.bvb@...
Send Email
Oct 5, 2005
1:28 pm

Hi Sandeep, ... Wow, you are using a VERY old version of ACE. I recommend that you upgrade to ACE+TAO x.4.7, which you can download from ...
Douglas C. Schmidt
schmidt@...
Send Email
Oct 6, 2005
7:31 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help