From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Alex Harsanyi <alexharsanyi@gmail.com>
Newsgroups: gmane.emacs.devel
Subject: Re: "resource temporarily unavailable" errors on windows 7
Date: Wed, 14 Mar 2012 13:34:42 +0800
Message-ID: <CAH-ciFpUX2T6_xxFrq1aAJOhhasRmFaZK4mWeZJJEfYoXQ8oMg@mail.gmail.com>
References: <CAH-ciFoNr0U7FfJ488MCLSS+zCc6WFF1YrZsQaXXfbL0V8docw@mail.gmail.com>
	<83aa3lybos.fsf@gnu.org>
	<CAH-ciFpTUaMyqZgy-OBrM0S=DKq=KVRsg8Y74DYuEgvOyDk-=Q@mail.gmail.com>
	<CAH-ciFryjk30BsozbaNx8n19aa5LaJFG_=EU1x+osoX3v=Kmsg@mail.gmail.com>
	<83vcm9w3th.fsf@gnu.org>
	<CAH-ciFq+srBc2=g3kmy9gfJGPcBfS=VajPnjcMB4pn1G-cwqNg@mail.gmail.com>
	<83obs0wb0p.fsf@gnu.org>
	<CAH-ciFpFFt4FQXOGD8hLkKC6ws80dKz6NE8Pn6+VWkyjCZBS2g@mail.gmail.com>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: dough.gmane.org 1331703300 32463 80.91.229.3 (14 Mar 2012 05:35:00 GMT)
X-Complaints-To: usenet@dough.gmane.org
NNTP-Posting-Date: Wed, 14 Mar 2012 05:35:00 +0000 (UTC)
Cc: emacs-devel@gnu.org
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 14 06:34:59 2012
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1S7grP-0003ic-HS
	for ged-emacs-devel@m.gmane.org; Wed, 14 Mar 2012 06:34:55 +0100
Original-Received: from localhost ([::1]:39681 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1S7grO-0003uN-Nv
	for ged-emacs-devel@m.gmane.org; Wed, 14 Mar 2012 01:34:54 -0400
Original-Received: from eggs.gnu.org ([208.118.235.92]:44037)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexharsanyi@gmail.com>) id 1S7grL-0003u7-Kg
	for emacs-devel@gnu.org; Wed, 14 Mar 2012 01:34:52 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <alexharsanyi@gmail.com>) id 1S7grJ-00005L-Qc
	for emacs-devel@gnu.org; Wed, 14 Mar 2012 01:34:51 -0400
Original-Received: from mail-wi0-f177.google.com ([209.85.212.177]:60590)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <alexharsanyi@gmail.com>)
	id 1S7grF-0008W5-Lf; Wed, 14 Mar 2012 01:34:45 -0400
Original-Received: by wibhj13 with SMTP id hj13so1518718wib.12
	for <multiple recipients>; Tue, 13 Mar 2012 22:34:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	bh=+J/fKR8YLjOfecZKlPevk2zB07Jjdf/fv5Mdu8nxtdY=;
	b=q0eFpJlD1xFZBFr+HptXrofS/rpfcBVw+7rYf+WMRQIBmkauzeP6fkNPDxUOsgf+Km
	BvJpvVP1BwPuGLtn+TEp1eN3+/zBYBwYqVbZCnoMgxXP07FUD4ADyLZLKmxHd+RfPID0
	JSC/lhPhQAwQZYiZU2i7x3gGLWaLZJzZdbiAF5cKMLAG4cWgu4LCU0CNxlaAKB1wIt2Q
	7w6gbds/JNV2oVJ0RZM1tkt0g2gvX3gepbYt90s7EuVBw/QzqzZJM367gn67fYvjlUn3
	ZptnZo3kYXqzIU827CiK4FrIIveIe0i6OoQjOWaEhhvsgvvDwSVT4ALy0RmALkHDcwbt
	hikA==
Original-Received: by 10.180.101.136 with SMTP id fg8mr13716669wib.4.1331703282710;
	Tue, 13 Mar 2012 22:34:42 -0700 (PDT)
Original-Received: by 10.223.64.212 with HTTP; Tue, 13 Mar 2012 22:34:42 -0700 (PDT)
In-Reply-To: <CAH-ciFpFFt4FQXOGD8hLkKC6ws80dKz6NE8Pn6+VWkyjCZBS2g@mail.gmail.com>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.85.212.177
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.devel:149029
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/149029>

2012/3/14 Alex Harsanyi <alexharsanyi@gmail.com>:

> Each time I start a shell process "M-x shell" (I rename the buffers,
> so I have multiple shells running), the stack reserved size grows by
> about 8Mb, the commited size by about 12K and the free memory
> decreases by 8Mb. =A0The Private Data commited size also changes by a
> few KB.

I checked the executable headers, and the default thread stack size is
set to 8Mb. "objdump -p emacs.exe" lists (among other things):

    SizeOfStackReserve      00800000
    SizeOfStackCommit      00001000

I also read the MSDN documentation for CreateThread and it looks like
the dwStackSize parameter represents the commit size unless the
STACK_SIZE_PARAM_IS_A_RESERVATION flag is passed to CreateThread.   I
tried adding this flag, but it was not recognized by mingw so I
replaced it with the value (0x00010000).

When I recompiled, the resulting emacs would reserve 1Mb of stack for
each new thread.  I than tried a few values for the dwStackSize
parameter and the smallest stack reservation I could obtain was 64K,
Here is the call:

   cp->thrd =3D CreateThread (NULL, 64 * 1024, reader_thread, cp,
0x00010000, &id);

It also seems that the reserved stack size reverts to 1Mb if
dwStackSize is too small: the folowing values for dwStackSize will
result in 1Mb being reserved:  4, 1024, 4*1024 and the following
values will cause 64K to be reserved: 8*1024, 32*1024, 64*1024.

Alex.





Alex.


>
> When I start emacs normally (reading the init files), the Free section
> has 47'224K and decreases by 8Mb for each shell process I start (Stack
> increases accordingly).
>
> I also noticed that spontaneously, the Stack reserved size grows by
> about 10-12Mb (Free section decreases accordingly), than the memory is
> released a few seconds later. =A0By spontaneous, I mean that I don't
> interact with the Emacs session, I just hit refresh on the VMMap
> application. =A0This happens also when I start emacs with "emacs -Q".
>
> Alex.