- Type-erased container supporting up to 256 types via custom TypeTraits
- 24-byte small buffer optimization for stack allocation
- Automatic heap allocation for large types
- No C++ exceptions or RTTI required
- C++14 compatible implementation
- 32 bytes total overhead per instance
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement configurable memory limits to prevent out-of-memory conditions when
parsing large USD files. Memory usage is tracked during parsing and loading
fails gracefully when limits are exceeded.
USDC Parser:
- Add memory tracking via CHECK_MEMORY_USAGE/REDUCE_MEMORY_USAGE macros
- Track allocations in crate-reader.cc for tokens, arrays, and data structures
- Pass memory limit from USDLoadOptions through USDCReaderConfig
- Initialize _memoryUsage in CrateReader constructor
USDA Parser:
- Add max_memory_limit_in_mb to USDAReaderConfig (default 16GB)
- Add memory tracking members to AsciiParser class (default 128GB)
- Implement SetMaxMemoryLimit() method in AsciiParser
- Track allocations for arrays, references, and string data
- Add CHECK_MEMORY_USAGE calls in push_back operations
Both parsers now:
- Respect USDLoadOptions::max_memory_limit_in_mb setting
- Provide clear error messages showing limit and current usage
- Fail gracefully before system runs out of memory
Testing:
- Verified with suzanne-subd-lv5.usdc/usda at various limits (10MB, 50MB, 500MB)
- Small files load successfully with 1MB limit
- Memory limits properly enforced at different parsing stages
This feature is especially useful for:
- Mobile/embedded devices with limited memory
- Server environments with resource quotas
- Preventing DoS from malicious/corrupted USD files
- Debugging memory usage patterns in USD files
- Add RectLight support throughout parser and composition system
- Implement Shadow API for all light types (shadowEnable, shadowColor, shadowDistance, shadowFalloff, shadowFalloffGamma)
- Add Shaping API for boundable lights only (shapingFocus, shapingFocusTint, shapingConeAngle, shapingConeSoftness)
- Enhance DiskLight with missing basic attributes (color, intensity, exposure, normalize, enableColorTemperature, colorTemperature)
- Enhance DistantLight with missing basic attributes
- Add DomeLight texture support via inputs:texture:file
- Fix typo in CylinderLight visibility enum handler
- Properly restrict Shaping API to boundable lights (excludes DistantLight and DomeLight per USD spec)