Skip to content

Reduce memory consumption in JoinVerticesProcess::ProcessMesh() signi… - #5252

Merged
kimkulling merged 4 commits into
assimp:masterfrom
ockeymm:master
Oct 1, 2023
Merged

kimkulling merged 4 commits into
assimp:masterfrom
ockeymm:master

Conversation

@ockeymm

@ockeymm ockeymm commented Sep 26, 2023 •

Copy link
Copy Markdown
Contributor
    When execute JoinVerticesProcess::ProcessMesh(), 'uniqueVertices' and 'uniqueAnimatedVertices' Array will consumption huge memory, some device will oom when execute this funcation.

For example:
The size of each array's element - Vertex structure is 272 bytes. If there is a mesh of 100000 Vertex and 52 animationMeshes, these two arrays will consume 100000 * 272 * 53=1441600000 memory during function operation.
I changed the elements of the array from the Vertex structure to the index of the vertex in the original data, and then assigned the vertex to the new target by searching for the original data in the updateXMeshVertices function. In the above example, using this method, the memory usage can be reduced to 100000 * 4 * 53=21200000

@kimkulling

Copy link
Copy Markdown
Member

A good idea. Let's see what the CI says to it.

@kimkulling

Copy link
Copy Markdown
Member

This will decrease the memory consumption for the process by 68. Whowow!

@kimkulling kimkulling left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks fine for me!

@kimkulling
kimkulling merged commit 7b6bf13 into assimp:master Oct 1, 2023
@kimkulling

Copy link
Copy Markdown
Member

Merged, thanks a lot for your contribution.

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.

3 participants