Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

memory leaks on windows when using tinyobj_loader_opt.h #283

Copy link
Copy link
@natevm

Description

@natevm
Issue body actions

Describe the issue

After calling "parseObj", lfpAlloc appears to leak memory. This seems to occur when vectors using lfpAlloc are resized, especially during emplace / push_back. This memory leak can be significantly large when loading hundreds of OBJ files.

By simply removing the "lfpAlloc" from all std::vectors used in tinyobj_loader_opt.h, I no longer leak memory.

To Reproduce

  1. repeatedly call parseObj.
  2. profile memory usage
  3. observe a collection of "lfpAlloc::Node<lfpAlloc::Chunk<<>>"'s that should be free'd once parseOBJ returns, but are not.

Please attach minimal and reproducible files(source codes, .obj/.mtl files, etc)

See @ogrex 's comment on issue #153. Repro can be done by modifying the "viewer.cc" file to repeatedly load a moderately large obj file.

Expected behavior
On return, parseOBJ should free all existing allocations to "lfpAlloc::Node<lfpAlloc::Chunk<<>>".
Alternatively, lfpAlloc should be removed as a dependency of tinyobj_loader_opt.h entirely, as this seems to fix the memory leak. I do not notice a significant impact on performance by removing lfpAlloc, however, more testing might be required to validate this is true.

Environment

  • TinyObjLoader version: tinyobj_loader_opt.h on d2cb6d2
  • OS: Windows 10
  • Compiler: MSVC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.