Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python bindings: detected a memory leak of type 'yarp::os::Type *' #2889

Open
valegagge opened this issue Nov 3, 2022 · 2 comments
Open

Comments

@valegagge
Copy link
Member

Describe the bug
I'm trying to set a reader to a yarp port. When I run the code this string comes out
swig/python detected a memory leak of type 'yarp::os::Type *', no destructor found.

To Reproduce
You can use this code:

import yarp

class DataProcessor(yarp.PortReader):

    def read(self,connection):
        #print("in DataProcessor.read")
        if not(connection.isValid()):
            print("testOne: connection not valid...closing")
            return False
        bin = yarp.Bottle()
        #bout = yarp.Bottle()
        print("Trying to read from connection")
        ok = bin.read(connection)
        if not(ok):
            print("testOne: failed to read input")
            return False
       
        print("Received [%s]"%bin.toString())
        return True
        
 

def main():
    yarp.Network.init()

    if not yarp.Network.checkNetwork():
        print("yarpserver is not running")
        quit()

    myport = yarp.Port()
    dataProc = DataProcessor()
    myport.setReader(dataProc)
    myport.open("/testOne/cmd:i")

if __name__ == "__main__":
    main()

Configuration (please complete the following information):

  • OS: Ubuntu 20.04.4 LTS
  • yarp version: 3.7.2+14-20221007.2+gita00b1e6e7
  • compiler: -
@randaz81
Copy link
Member

Help requested...

@PeterBowman
Copy link
Member

Possibly related, I also noticed a missing destructor issue in Python bindings generated for downstream YARP projects: #2757 (look for %include "yarp/os/Type.h" // avoid SWIG memory leaks due to a missing destructor).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants