Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas026.isp.belgacom.be (localhost [127.0.0.1])
        by inav006.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k0GBBrFI014627
        for <joris.at.lebbeke@skynet.be>; Mon, 16 Jan 2006 12:11:54 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx014.isp.belgacom.be (inmx014.isp.belgacom.be [195.238.4.217])
        by inas026.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k0GBBPcQ017558
        for <joris.at.lebbeke@skynet.be>; Mon, 16 Jan 2006 12:11:46 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx014.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id k0GBBLp2020286
        for <joris.at.lebbeke@skynet.be>; Mon, 16 Jan 2006 12:11:21 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k0GB286X023975;
	Mon, 16 Jan 2006 06:03:24 -0500
Received: from smtp15.wanadoo.fr (smtp15.wanadoo.fr [193.252.23.84])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k0GB250V023972
	for <tiff@lists.maptools.org>; Mon, 16 Jan 2006 06:02:06 -0500
Received: from me-wanadoo.net (localhost [127.0.0.1])
	by mwinf1503.wanadoo.fr (SMTP Server) with ESMTP id BF3AC700008F
	for <tiff@lists.maptools.org>; Mon, 16 Jan 2006 12:02:04 +0100 (CET)
Received: from wwinf1525 (wwinf1525 [172.22.146.49])
	by mwinf1503.wanadoo.fr (SMTP Server) with ESMTP id BD1E57000081
	for <tiff@lists.maptools.org>; Mon, 16 Jan 2006 12:02:04 +0100 (CET)
X-ME-UUID: 20060116110204774.BD1E57000081@mwinf1503.wanadoo.fr
Message-ID: <10433944.1137409324766.JavaMail.www@wwinf1525>
From: Bogoss <tub95@wanadoo.fr>
To: tiff@lists.maptools.org
Subject: RE: [Tiff] Problem closing TFF file : First Chance exception
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Originating-IP: [81.255.124.105]
X-Wum-Nature: EMAIL-NATURE
X-WUM-FROM: |~|
X-WUM-TO: |~|
X-WUM-REPLYTO: |~|
Date: Mon, 16 Jan 2006 12:02:04 +0100 (CET)
X-MIME-Autoconverted: from quoted-printable to 8bit by duke.maptools.org id
	k0GB250V023972
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
Reply-To: tub95@wanadoo.fr
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by inav006.isp.belgacom.be id k0GBBrFI014627
X-UIDL: 000000000023ceae.0000116d
X-MSP-STORE: Mon, 16 Jan 2006 12:11:59 +0100
Status:   

Good morning all,

The problem concerning the error on the instruction TIFFClose : First-Cha=
nce exception in test.exe (NTDLL.DLL) : 0x0000008 : Invalid Handle is res=
olved.
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 s=
ee 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=3D0;i<=3D10000;i++){
	=09
		sprintf(nom,"test_%d.001",i);
		in =3D 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;  =20
     if((out =3D TIFFOpen(file, "wl")) =3D=3D 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 da=
ta
    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=C3=A9thode de compression
    TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX3);
    TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
    // Ordre des bits invers=C3=A9
    TIFFSetField(out, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
    TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
   =20
    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 :)


_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
