-
Notifications
You must be signed in to change notification settings - Fork 323
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
closed #3
Comments
Ptr是智能指针类,将在变量退出作用域时自动销毁。 |
恩恩,做了些实验搞明白了!在退出点云构造的子函数时,我们通过return一个shared_ptr指针的方式,保证在退出子函数时,虽然指针被销毁了,但由于在指针被销毁前,将该指针赋值给了visualOdometry函数中的另外一个指针,所以保证了指针指向的点云数据并没有被销毁,只有当下一次调用该子函数时,才会销毁上一帧的点云数据。我这么理解可以么? |
并不对,智能指针只有在引用计数的时候才销毁,即,在没有任何一处继续持有实际点云数据时,才被销毁。 |
啊,还是不对么?
每次在调用joinPointCloud子函数拼接点云,然后返回给visualOdometry函数中的cloud时,这个时候没有一处继续持有上一帧的实际点云数据,就会销毁上一帧在堆上申请的点云空间。
同理,每次在joinPointCloud子函数中调用image2PointCloud子函数生成点云,在退出子函数时,因为newCloud指针的销毁,没有一处持有该点云数据,对应的堆空间也会被销毁。
这样的分析有哪里不对的地方?
多谢高博指点!
祝好!
在2017年8月6日 22:29,Xiang Gao<[email protected]> 写道:
并不对,智能指针只有在引用计数的时候才销毁,即,在没有任何一处继续持有实际点云数据时,才被销毁。
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: