1 Replies - 14914 Views - Last Post: 09 April 2011 - 12:23 PM

#1 Qmage  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-April 11

IntPtr Causing Memory Leak?

Posted 09 April 2011 - 12:08 PM

This function is in a loop. When I run the program, the line with IntPtr is giving me memory problems, I've put delete[], but it still doesn't solve the memory problem, can anyone help please? thanks


void showImage(IplImage *img,System::Windows::Forms::PictureBox^ picturebox)
{

IntPtr ip(new unsigned char[img->widthStep*img->height]); // this line causing memory usage to keep going up very fast

//memcpy(ip.ToPointer(),img->imageData,img->widthStep*img->height);

//picturebox->Image = gcnew Bitmap(img->width,img->height, img->widthStep, System:rawing::Imaging::PixelFormat::Format24bppRgb, ip);

delete[] ip;
} 



Is This A Good Question/Topic? 0
  • +

Replies To: IntPtr Causing Memory Leak?

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,496
  • Joined: 23-August 08

Re: IntPtr Causing Memory Leak?

Posted 09 April 2011 - 12:23 PM

Moved to C++ CLI
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1