错误提示:"Out of Memory",如何处理??请指点一下……
vc/mfc Dialog项目,想要实现条形码打印的功能,我自定义了一个画条形码的函数,但是执行的时候,却出现错误提示:"Out of Memory"。代码如下,请帮忙找找错误的地方:
int CtestPrintDlg::Print(LPSTR text, CDC* pDC)//画条形码的函数
{
CPen pen, *pOldPen;
int High,i;
LPSTR str = text;
//设定左上角初始点
CPoint point(50,50);
//就是在执行下面这行代码的时候,出现错误提示“Out of Memory”
pen.CreatePen(PS_SOLID, int(CodeWidth*rato), RGB(0,0,0));
//将画笔选入打印设备环境
pOldPen = pDC->SelectObject(&pen);
High = int(CodeHigh*rato);
while(*str)
{
for (i = 0; i< (*str-'0');i++)
{
pDC->MoveTo(point);
pDC->LineTo(point.x, point.y + High);
point.x += int(CodeWidth*rato);
}
str++;
point.x += int(CodeWidth*rato)*(*str - '0');
str++;
}
pDC->SelectObject(pOldPen);
pen.DeleteObject();//销毁
return 0;
}
int CtestPrintDlg::Print(LPSTR text, CDC* pDC)//画条形码的函数
{
CPen pen, *pOldPen;
int High,i;
LPSTR str = text;
//设定左上角初始点
CPoint point(50,50);
//就是在执行下面这行代码的时候,出现错误提示“Out of Memory”
pen.CreatePen(PS_SOLID, int(CodeWidth*rato), RGB(0,0,0));
//将画笔选入打印设备环境
pOldPen = pDC->SelectObject(&pen);
High = int(CodeHigh*rato);
while(*str)
{
for (i = 0; i< (*str-'0');i++)
{
pDC->MoveTo(point);
pDC->LineTo(point.x, point.y + High);
point.x += int(CodeWidth*rato);
}
str++;
point.x += int(CodeWidth*rato)*(*str - '0');
str++;
}
pDC->SelectObject(pOldPen);
pen.DeleteObject();//销毁
return 0;
}
...全文
相关推荐
Git使用小坑 Out of memory错误的解决方法
Git是世界上最流行的分布式版本控制系统,但在使用过程中可能会遇到各种问题,其中之一就是"Out of memory"错误。
pytorch模型提示超出内存RuntimeError: CUDA out of memory.
跑模型时出现RuntimeError: CUDA out of memory.错误 查阅了许多相关内容,原因是:GPU显存内存不够简单总结一下解决方法:将batch_size改小。取torch变量标量
Pytorch GPU显存充足却显示out of memory的解决方式
首先,我们要理解“out of memory”错误并不一定意味着物理GPU内存不足。
详解Pycharm出现out of memory的终极解决方法
"PyCharm出现'out of memory'错误的解决方案"在使用PyCharm进行编程时,可能会遇到“out of memory”的错误提示,这通常意味着PyCharm分配的内存不足以运
解决Pytorch 训练与测试时爆显存(out of memory)的问题
): print("WARNING: out of memory") if hasattr(torch.cuda, 'empty_cache'): torch.cuda.empty_cache() else


