Skip to content

Removed memory leak in layer factory#6562

Open
infomaniac777 wants to merge 1 commit intoBVLC:masterfrom
infomaniac777:master
Open

Removed memory leak in layer factory#6562
infomaniac777 wants to merge 1 commit intoBVLC:masterfrom
infomaniac777:master

Conversation

@infomaniac777
Copy link

This PR addresses the following:

  1. Using new for allocating a std::map is redundant and less idiomatic than allocating it directly on stack. The actual memory required for std::map will be allocated as per need basis from heap automatically.
  2. Using new for a static pointer technically causes a memory leak here since delete is never really called for this.
    This change will address both these problems as stack objects are guaranteed to be freed on program termination.

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

Successfully merging this pull request may close these issues.

1 participant