è un problema che mi era capitato per lo stesso motivo e lo avevamo risolto in un topic precedente, ma in questo nuovo codice si ripresenta di nuovo: la riga in grossetto e i due array col e col2 accrescono l'utilizzo di ram ad ogni ciclo e non so come pulirle...

grazie di nuovo
codice:
//----------------------------------------------------------------------------- 
#include "ppm_image.h" 
#include <complex> 
#include <math.h> 
#include <windows.h> 
//----------------------------------------------------------------------------- 
using namespace std; 
//----------------------------------------------------------------------------- 

#define WIDTH  10000
#define HEIGHT 10000

                 #define Y1 2
#define X0 -2
                                 #define X1 2
                 #define Y0 -2

#define julia1 -0.7268953
#define julia2 0.18888

#define DEPTH 4000

unsigned int * hsv_rgb(unsigned int *);

int main() 
   { 
   complex<double> value, point, julia; 
   julia = complex<double>(julia1,julia2);
   double r, i, modulo; 
   long cnt; 
   
   //dati utili per colorare
   long cnt_tot=0, media_cnt=0, media_cnt_n=0, c_cnt=0;
   unsigned int *col;
   col = new unsigned int[3]; col[0]=0;col[1]=0;col[2]=0;
   unsigned int *col2;
   col2 = new unsigned int[3]; col2[0]=0;col2[1]=0;col2[2]=0;  
    
   // Creo un'immagine vuota di dimensione WIDTH*HEIGHT 
   PpmImage img(WIDTH, HEIGHT); 

   for(int x=0; x<WIDTH; x++){ 
      r = X0+((double(x)*(X1-X0))/double(WIDTH));       
      for(int y=0; y<HEIGHT; y++){ 
         i = Y0+((double(y)*(Y1-Y0))/double(HEIGHT)); 
         
         point = complex<double>(r,i); 
         value = point; 
          
         // iniziamo il ciclo 
         for(cnt=0; cnt<DEPTH; cnt++){ 
            value = value*value+julia; 
            modulo = abs(value); 
            if(modulo>2)break; 
         } 
             
         if(modulo<=2){ 
            img.SetPixel(x,y,0,0,0); 
         } 
         else{ 
            // invece di disegnare un pixel bianco ne disegno uno colorato che dipende da cnt 
            unsigned int red, green, blue; //colore, contrasto, luminosità
            
            cnt_tot=cnt_tot+cnt;
            media_cnt_n++;
            c_cnt = cnt;
            
            red   = (c_cnt)%360; 
            green = 250; 
            blue  = 250;   

            if(red>359)   red=359; 
            if(green>255) green=255; 
            if(blue>255)  blue=255; 
            
            col[0]=red;
            col[1]=green;
            col[2]=blue;

            col2 = hsv_rgb(col); 

            img.SetPixel(x, y, col2[0], col2[1], col2[2]); 

         } 
      } 
      printf("%d\n",x);
   } 

   // Salvo l'immagine 
   img.SaveToFile("mandelbrot.ppm"); 
   
   media_cnt=cnt_tot/media_cnt_n;
   printf("cnt medio: %d\n",media_cnt);
   system("pause");
   return 0;
}

unsigned int * hsv_rgb(unsigned int hsv[3]){
         
    //printf("REVERSE:\nH:%d\nS:%d\nV:%d\n",hsv[0],hsv[1],hsv[2]);          
    double *dRGB;
    dRGB = new double[3];    
    
    double H = ((double)hsv[0]);
    double S = ((double)hsv[1])/255;
    double V = ((double)hsv[2])/255;
    
    double hi = ((int)(H/60))%6;
    double f = (H/60) - (double)hi;
    double p = V*(1-S);
    double q = V*(1-(f*S));
    double t = V*(1-(1-f)*S);
    
    if (hi == 0){ dRGB[0]=V;dRGB[1]=t;dRGB[2]=p;}
    else if (hi == 1){ dRGB[0]=q;dRGB[1]=V;dRGB[2]=p;}
    else if (hi == 2){ dRGB[0]=p;dRGB[1]=V;dRGB[2]=t;}
    else if (hi == 3){ dRGB[0]=p;dRGB[1]=q;dRGB[2]=V;}
    else if (hi == 4){ dRGB[0]=t;dRGB[1]=p;dRGB[2]=V;}
    else if (hi == 5){ dRGB[0]=V;dRGB[1]=p;dRGB[2]=q;}
    else printf("ERRORE!");

    //printf("R:%f\nG:%f\nB:%f\n",dRGB[0],dRGB[1],dRGB[2]);
    
    unsigned int *RGB;
    RGB = new unsigned int[3];    
    
    RGB[0] = (int)(dRGB[0]*255);
    RGB[1] = (int)(dRGB[1]*255);
    RGB[2] = (int)(dRGB[2]*255);
    
    free(dRGB); 
    
    //printf("R:%d\nG:%d\nB:%d\n",RGB[0],RGB[1],RGB[2]);  
    return RGB;   
}