Repository navigation
v0.9.10
v0.0.10 - Improved Memory Management
Highlights
This release improves the buffer sizing system to provide more flexibility and better memory utilization on the GPU.
New Features
Dynamic Buffer Capacity System
- Buffers now track total pixel capacity instead of fixed width×height dimensions
- Reuse the same buffer for different aspect ratios within capacity
buffer = Image(4096, 4096) # 16M pixel capacity
buffer.resize(8192, 2048) # Landscape (16M pixels)
buffer.resize(2048, 8192) # Portrait (16M pixels)
buffer.resize(4096, 4096) # Square (16M pixels)New resize() Method
- Atomic dimension updates - change width and height together safely
- Prevents validation order issues
img = Image(1920, 1080)
img.resize(3840, 540) # Works smoothlyChanges
API Changes
Image.get_max_capacity()now returnsint(total pixels) instead oftuple[int, int]
# Before
max_w, max_h = img.get_max_capacity() # (1920, 1080)
# After
max_pixels = img.get_max_capacity() # 2,073,600Internal Improvements
- Removed internal
ensure_capacity()utility function - All operations now use
buffer.resize()directly - Cleaner buffer reuse patterns across all modules
Documentation
- Updated buffer sizing examples
- Clarified capacity concepts in Image & Memory guide
- All examples updated to reflect new API
Migration Guide
If you used get_max_capacity():
# Before
max_w, max_h = img.get_max_capacity()
if width * height > max_w * max_h:
raise ValueError("Too large")
# After
max_pixels = img.get_max_capacity()
if width * height > max_pixels:
raise ValueError("Too large")If you set dimensions individually:
# Before (could fail depending on order)
img.width = 3840
img.height = 540
# After (recommended)
img.resize(3840, 540)
# Individual setters still work for simple cases
img.width = 1920
img.height = 1080Breaking Changes
Image.get_max_capacity()return type changed fromtuple[int, int]toint- Impact: Low - This method is rarely used directly in user code
- Fix: Use total pixel capacity instead of individual dimensions (see migration guide)
Technical Details
- All C/CUDA kernels remain unchanged and 100% compatible
- Buffer indexing works identically
- Zero performance impact - same GPU operations, cleaner Python API