| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2006.01.16 11:02 "Re: Problem closing TFF file : First Chance exception", by <tub95@wanadoo.fr>Good morning all,
The problem concerning the error on the instruction TIFFClose : First-Chance
exception in test.exe (NTDLL.DLL) : 0x0000008 : Invalid Handle is resolved.
To resolve the problem, I installed tiff version 3.8. I had the 3.7.4
But now, it's new problem that I did not have before (maybe i must create a
new topic :/)
I have a memory leak when i create several tiff files.
I made a simple test : I open, write and close several tiff files and i see
in the task manager of windows that the memory increases 4Kb for every new
files.
---------------------------------------------------------------
---------------------------------------------------------------
unsigned char page_portrait_fine[2290][216];
void Pause(){
cout<<"Push a key to resume ..."<<endl;
getch();
}
void main(){
char nom[20];
TIFF *in;
for(int i=0;i<=10000;i++){
sprintf(nom,"test_%d.001",i);
in = OpenTiff(nom);
CreateHeader(in);
TIFFWriteEncodedStrip(in,0,page_portrait_fine,216*2290);
CloseTiff(in);
Pause();
}
}
// Open TIFF File
TIFF* OpenTiff(char file[NOM]){
TIFF *out;
if((out = TIFFOpen(file, "wl")) == NULL){
return NULL;
}
return(out);
}
// Close TIFF file
void CloseTiff(TIFF* file){
TIFFClose(file);
}
void CreateHeader(TIFF *out){
// We need to set some values for basic tags before we can add any data
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, 1728);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, 2290);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, 2290);
//Méthode de compression
TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX3);
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
// Ordre des bits inversé
TIFFSetField(out, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(out, TIFFTAG_XRESOLUTION, 204.0);
TIFFSetField(out, TIFFTAG_YRESOLUTION, 196.0);
TIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
}
---------------------------------------------------------------
---------------------------------------------------------------
i don't know if it's a bug ...
PS : to update libtiff to the 3.8, i just replace :
- libtiff.lib in "C:\Program Files\Microsoft Visual Studio\VC98\Lib"
- tiffvers.h
tiff.h
tiffconf.h
tiffio.h
in "C:\Program Files\Microsoft Visual Studio\VC98\include"
- and add dll depedencies in System32 directory
Thanks for your help :)
|
|||||||