From owner-freebsd-java@FreeBSD.ORG Thu Jul 23 11:04:08 2009 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6249106566B for ; Thu, 23 Jul 2009 11:04:08 +0000 (UTC) (envelope-from artemciy@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mx1.freebsd.org (Postfix) with ESMTP id 346D68FC1C for ; Thu, 23 Jul 2009 11:04:07 +0000 (UTC) (envelope-from artemciy@gmail.com) Received: by fg-out-1718.google.com with SMTP id 13so232121fge.12 for ; Thu, 23 Jul 2009 04:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=MmSjjlhBhjqQ/g/5zUoCSAXnBPn/S6hUNh3fVv1V/Hw=; b=GnYnMBGAoWR4P82C5rDPyPsTaVAlZROOa+TscjLJRa01gjPLA3Hus7rBAYpP62H+jC rbe+lQXGaN3lD4GubPH1kVLCt7KVM58vIBmx+Q1jba83t3SxSzYNyDXydSjPtyrIh8ON scgcGn++DLKAYbM2T/NTi4encIWzb884tHfZs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=eceGCQg160mKy42oy5ErbIsiwV2xAFElXdFTs3i7WAKZSqZP07p8Z39by4CFd01G7x rg46BXcWc9LXzYYgW/cNtzY9MV9af8bVUnlPa37mThMkidALk4lkUBKKS4DvnmpbyH97 0YF60IJiDj2sWALskh7SwG9gVE2dVBam+Hkhk= Received: by 10.86.98.18 with SMTP id v18mr1771188fgb.13.1248345234357; Thu, 23 Jul 2009 03:33:54 -0700 (PDT) Received: from ?192.168.1.4? ([77.232.13.65]) by mx.google.com with ESMTPS id l12sm19370783fgb.13.2009.07.23.03.33.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 23 Jul 2009 03:33:54 -0700 (PDT) Message-ID: <4A683C8F.3030608@gmail.com> Date: Thu, 23 Jul 2009 14:33:51 +0400 From: ArtemGr User-Agent: Thunderbird 2.0.0.22 (X11/20090721) MIME-Version: 1.0 To: freebsd-java@freebsd.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: file size growth on FileChannel.map X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2009 11:04:11 -0000 When I use a FileChannel.map several times to map a large region into memory, the file size suddenly increase. The mapped region is always withing the file, e.g. always less than FileChannel.position! I monitored FileChannel.position and FileChannel.size: FileChannel.position stays the same, yet FileChannel.size increases after mapping. The file itself increases too, with the new space containing all zeroes. The increase is large, tens and hundreds of megabytes. I had my files grow to several gigabytes just by mmaping regions of them. I don't think it is an expected behaviour, AFAIK. FreeBSD mmap might return a larger portion of memory to match a page size, but it isn't supposed to grow the underlying file. Therefore I suspect it might be a bug in (FreeBSD version of) the JDK. I encountered the problem on 7.2-RELEASE amd64, openjdk version "1.6.0-internal", ZFS and 7.2-STABLE (May 25) amd64, java version "1.6.0_07", UFS2 Had anybody seen such behaviour from FileChannel.map? Am I right supposing it shouldn't grow the file? Should I investigate further?