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

Memory leak #78

Open
mistermult opened this issue Mar 6, 2020 · 1 comment
Open

Memory leak #78

mistermult opened this issue Mar 6, 2020 · 1 comment

Comments

@mistermult
Copy link

Hello,

thank you for the great library. The following program does nothing, yet the memory consumption is increasing monotonically (560MB RSS, 1.2GB VM-Size after some time):

using RobotOS
@rosimport geometry_msgs.msg: Point, Pose2D
rostypegen()
using .geometry_msgs.msg

function main()
    init_node("juliatest")
    #pub = Publisher{Point}("jlpoint", queue_size=10)
    loop_rate = Rate(200.0)
    #npt = Point(0, 0, 0)
    while ! is_shutdown()
        #npt.x = npt.x + 1
        #npt.y = npt.y + 1
        #publish(pub, npt)
        rossleep(loop_rate)
    end
end

main()

The program in Python (it even does more) has not an increasing memory consumption and uses less memory (50MB RSS, 380MB VM-Size). Moreover, it uses only 1% instead of 4% of CPU.

#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
from geometry_msgs.msg import Point

def main():
    rospy.init_node('python_test')
    pub = rospy.Publisher('pypoint', Point, queue_size=10)
    pt = Point(0, 0, 0)
    rate = rospy.Rate(200)
    while not rospy.is_shutdown():
        pub.publish(pt)
        rate.sleep()

if __name__ == '__main__':
    try:
        main()
    except rospy.ROSInterruptException:
        pass

What do you think is the reason for the increasing memory consumption? Can you give some hint? Maybe I can fix it. Do you know why the CPU consumption is higher?

@jdlangs
Copy link
Owner

jdlangs commented Jun 5, 2020

Hi @mistermult, have you investigated this further by chance?

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

2 participants