-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api: add memsize() methods to ParamValueList and ImageSpec #4317
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To aid some memory accounting, add a method to ParamValueList and ImageSpec that return the memory cost (the size of the struct and all the allocated things hanging off of it). We're trying to be more careful about understanding how much memory is used by having many copies of ImageSpec's lying around. Signed-off-by: Larry Gritz <[email protected]>
Signed-off-by: Larry Gritz <[email protected]>
This was referenced Jul 4, 2024
Withdrawing in favor of #4322 |
lgritz
pushed a commit
that referenced
this pull request
Aug 11, 2024
… memory tracking (#4322) First PR of two, following @lgritz and I discussions on memory tracking in the OIIO::ImageCache. - Add two template methods and their specializations for types various to help memory tracking: ```c++ // return the total heap allocated memory held by the object and its members template<typename T> inline size_t heapsize(const T& t); // return the total memory footprint including the size of the structure itself template<typename T> inline size_t footprint(const T& t); ``` - Specialized for: ParamValue, ParamValueList, ImageSpec, ImageInput, ImageOutput, std::vector, std::shared_ptr, std::unique_ptr, oiio::intrusive_ptr, ImageCacheImpl related objects. - New files: - `include/memory.h` : adds base and few types specialization of heapsize and footprint. - `libtexture/imagecache_memory_pvt.h` : adds specilializations for ImageCacheImpl and related objects. - `libtexture/imagecache_memory_print.h` : adds a helper function that print a breakdown of the ImageCacheImpl total memory usage as well, as well as per image format. Note: this is slow, but gives accurate memory estimation. Related PR from Larry : #4317 Signed-off-by: Basile Fraboni <[email protected]>
lgritz
pushed a commit
that referenced
this pull request
Sep 2, 2024
…utput (#4323) Second PR of two, following @lgritz and I discussions on memory tracking in the OIIO::ImageCache. - the memory tracking system from #4322 is not sufficient to track OIIO public objects that can be overriden. - add virtual `heapsize()` method to ImageInput and ImageOutput that return the total heap allocated memory held by the structure and its members. - [ ] **TODO**: override for every internal OIIO type (bmp, tiff, etc). Related PR from Larry : #4317 First PR: #4322 Signed-off-by: Basile Fraboni <[email protected]>
zachlewis
pushed a commit
to zachlewis/OpenImageIO
that referenced
this pull request
Sep 16, 2024
… memory tracking (AcademySoftwareFoundation#4322) First PR of two, following @lgritz and I discussions on memory tracking in the OIIO::ImageCache. - Add two template methods and their specializations for types various to help memory tracking: ```c++ // return the total heap allocated memory held by the object and its members template<typename T> inline size_t heapsize(const T& t); // return the total memory footprint including the size of the structure itself template<typename T> inline size_t footprint(const T& t); ``` - Specialized for: ParamValue, ParamValueList, ImageSpec, ImageInput, ImageOutput, std::vector, std::shared_ptr, std::unique_ptr, oiio::intrusive_ptr, ImageCacheImpl related objects. - New files: - `include/memory.h` : adds base and few types specialization of heapsize and footprint. - `libtexture/imagecache_memory_pvt.h` : adds specilializations for ImageCacheImpl and related objects. - `libtexture/imagecache_memory_print.h` : adds a helper function that print a breakdown of the ImageCacheImpl total memory usage as well, as well as per image format. Note: this is slow, but gives accurate memory estimation. Related PR from Larry : AcademySoftwareFoundation#4317 Signed-off-by: Basile Fraboni <[email protected]> Signed-off-by: Zach Lewis <[email protected]>
zachlewis
pushed a commit
to zachlewis/OpenImageIO
that referenced
this pull request
Sep 16, 2024
…utput (AcademySoftwareFoundation#4323) Second PR of two, following @lgritz and I discussions on memory tracking in the OIIO::ImageCache. - the memory tracking system from AcademySoftwareFoundation#4322 is not sufficient to track OIIO public objects that can be overriden. - add virtual `heapsize()` method to ImageInput and ImageOutput that return the total heap allocated memory held by the structure and its members. - [ ] **TODO**: override for every internal OIIO type (bmp, tiff, etc). Related PR from Larry : AcademySoftwareFoundation#4317 First PR: AcademySoftwareFoundation#4322 Signed-off-by: Basile Fraboni <[email protected]> Signed-off-by: Zach Lewis <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To aid some memory accounting, add a method to ParamValueList and
ImageSpec that return the memory cost (the size of the struct and all
the allocated things hanging off of it). We're trying to be more
careful about understanding how much memory is used by having many
copies of ImageSpec's lying around.
Have ImageCache stats estimate how much mem is tied up in ImageSpecs.