返回列表 发帖

[问题求助] [已解决]求助,vbs内存暴涨

本帖最后由 jyswjjgdwtdtj 于 2023-2-26 19:50 编辑

代码如下
myheight和mywidth大概500多
argb是一个字符串的8位的16进制数,toten将16进制数转为10进制
for i=1 to myheight
for j=1 to mywidth
k=k+1
argb=hex(argbdata(k))
set pixel(j,i)=new color
with pixel(j,i)
.argb=toten(argb)
.alpha=toten(mid(argb,1,2))
.red=toten(mid(argb,3,2))
.green=toten(mid(argb,5,2))
.blue=toten(mid(argb,7,2))
end with
next
nextCOPY
class color
public argb
public red
public green
public blue
public alpha
end classCOPY
为什么会消耗那么多内存?
在vbs错误代码原因里的“内存不足”一项里,它写有一种可能是对象实例过多
有关联吗

set pixel(j,i)=new color
500 x 500 个对象?

QQ 20147578

TOP

回复 2# czjt1234


    对

TOP

记得Demon说过推荐用数组或字典对象

QQ 20147578

TOP

返回列表