Skip to content
New issue

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

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

Already on GitHub? # to your account

[nav2_costmap_2s]: free correctly the memory in the InflationLayer #4424

Conversation

facontidavide
Copy link
Contributor

Basic Info

Info Please fill out this column
Ticket(s) this addresses none
Primary OS tested on Ubuntu
Robotic platform tested on Simulation
Does this PR contain AI generated software? No

Description of contribution in a few bullet points

When using very large maps ( we are talking about maps in the order of 200 Mb), we noticed that the InflationLayer would consume a VERY large amount of memory.

After investigation, we realized that:

  • memory is never freed
  • the total amount of memory consumed can be reduced (no spikes)

See the difference before and after:

Before

2024-06-12_11-27

After

2024-06-12_11-31

The impact in terms of performance (CPU usage) should be negligible

Description of documentation updates required from your changes

None


Future work that may be required in bullet points

None

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>
@facontidavide facontidavide force-pushed the dfaconti/inflation_layer_improvements branch from 44a48a9 to ee5349f Compare June 12, 2024 10:11
Note: performance was measured and this is slightly faster, even if we
need to recompute the index. Probably a benefit at the level of the CPU
cache

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>
Signed-off-by: Davide Faconti <davide.faconti@gmail.com>
Copy link
Contributor

@doisyg doisyg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested at Dexory, great memory gains proportional to the number of inflated cells. In other words bigger gains with big maps and small resolution.
Will wait to see if @SteveMacenski has a say and then we can merge.
@BriceRenaudeau fyi

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, no objections here!

@SteveMacenski SteveMacenski merged commit eb560c4 into ros-navigation:main Jun 12, 2024
9 of 10 checks passed
Marc-Morcos pushed a commit to Marc-Morcos/navigation2 that referenced this pull request Jul 4, 2024
…os-navigation#4424)

* [nav2_costmap_2s]: free correctly the memory in the InflationLayer

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

* Remove 4 redundant bytes from CellData in Inflationlayer

Note: performance was measured and this is slightly faster, even if we
need to recompute the index. Probably a benefit at the level of the CPU
cache

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

* formatting

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

---------

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>
Manos-G pushed a commit to Manos-G/navigation2 that referenced this pull request Aug 1, 2024
…os-navigation#4424)

* [nav2_costmap_2s]: free correctly the memory in the InflationLayer

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

* Remove 4 redundant bytes from CellData in Inflationlayer

Note: performance was measured and this is slightly faster, even if we
need to recompute the index. Probably a benefit at the level of the CPU
cache

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

* formatting

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

---------

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>
masf7g pushed a commit to quasi-robotics/navigation2 that referenced this pull request Oct 23, 2024
…os-navigation#4424)

* [nav2_costmap_2s]: free correctly the memory in the InflationLayer

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

* Remove 4 redundant bytes from CellData in Inflationlayer

Note: performance was measured and this is slightly faster, even if we
need to recompute the index. Probably a benefit at the level of the CPU
cache

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

* formatting

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>

---------

Signed-off-by: Davide Faconti <davide.faconti@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants