Skip to content

Memory leak #78

@mistermult

Description

@mistermult

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions