Skip to content

libobs/graphics: Restore image memory usage tracking - #14078

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
prgmitchell:fixImageMemory
Oct 27, 2026
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
prgmitchell:fixImageMemory

Conversation

@prgmitchell

Copy link
Copy Markdown
Member

Description

Pass the image memory counter to the internal initializer so legacy slideshows enforce their 400mb limit.

Fixes #14076

Motivation and Context

Reported issue, introduced with c3046ec

How Has This Been Tested?

Confirmed a 16mb test image was reporting 0 bytes memory usage, correctly reporting after this change.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@prgmitchell prgmitchell added Seeking Testers Build artifacts on CI kind/bug Categorizes issue or PR as related to a bug. labels Oct 24, 2026
@RytoEX RytoEX added this to the OBS Studio 33.0 milestone Oct 25, 2026
@RytoEX
RytoEX requested a review from Lain-B October 26, 2026 16:59
@RytoEX

RytoEX commented Oct 26, 2026

Copy link
Copy Markdown
Member

The old gs_image_file_ex_init() call also passed NULL here. Why is this just now an issue?

@prgmitchell

Copy link
Copy Markdown
Member Author

@RytoEX the image source was using gs_image_file4_init() previously which was passing mem_usage

void gs_image_file4_init(gs_image_file4_t *if4, const char *file, enum gs_image_alpha_mode alpha_mode)
{
gs_image_file_init_internal(&if4->image3.image2.image, file, &if4->image3.image2.mem_usage, &if4->space,
alpha_mode);
if4->image3.alpha_mode = alpha_mode;

but it now uses gs_image_file_ex_init() in image_source_preload_image

@RytoEX

RytoEX commented Oct 26, 2026

Copy link
Copy Markdown
Member

I see it now, thanks. gs_image_file2_init() and newer all passed the mem_usage member of gs_image_file2 and newer structs. Since all of the structs and functions were unified into the _ex variants, it makes sense that gs_image_file_ex_init() should do the same.

As a separate matter, gs_image_file3_init() and newer initialized the alpha_mode member of the gs_image_file3 struct, and the new code does not, but that is out of scope for this PR.

@RytoEX RytoEX 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.

Nit: should probably use libobs/graphics: as the commit prefix, but looks good otherwise.

@github-project-automation github-project-automation Bot moved this from Ready For Review to Requires Changes in Current Release Tracker (33.0) Oct 27, 2026
Pass the image memory counter to the internal initializer so legacy
slideshows enforce their 400mb limit.

Amends c3046ec.
Amends f86e9c1.
@RytoEX RytoEX added release-note/fix Groups pull request under the "Fixes" section in the associated patch notes area/libobs labels Oct 27, 2026
@RytoEX RytoEX changed the title libobs: Restore image memory usage tracking libobs/graphics: Restore image memory usage tracking Oct 27, 2026
@RytoEX
RytoEX merged commit 3dca8cd into obsproject:master Oct 27, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from Requires Changes to Merged in Current Release Tracker (33.0) Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libobs kind/bug Categorizes issue or PR as related to a bug. release-note/fix Groups pull request under the "Fixes" section in the associated patch notes Seeking Testers Build artifacts on CI

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

Memory usage in version 33.0.0 appears about 9 times higher than in 32.2.2, seems like a very unusual issue

2 participants