Revert "throw away"

This reverts commit 55d71c5b4ad7e9394731a39b82c8b149589a8fb3.
redo image texture memroy handling