mail-archives/mono-bugs/2010-July/102361.html

143 строки
5.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 623477] Different behavior on Thread(ThreadEntryPoint, maxStackSize) on .net and mono
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20623477%5D%20Different%20behavior%20on%0A%20Thread%28ThreadEntryPoint%2C%20maxStackSize%29%20on%20.net%20and%20mono&In-Reply-To=bug-623477-28286%40http.bugzilla.novell.com/">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="102360.html">
<LINK REL="Next" HREF="102318.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 623477] Different behavior on Thread(ThreadEntryPoint, maxStackSize) on .net and mono</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20623477%5D%20Different%20behavior%20on%0A%20Thread%28ThreadEntryPoint%2C%20maxStackSize%29%20on%20.net%20and%20mono&In-Reply-To=bug-623477-28286%40http.bugzilla.novell.com/"
TITLE="[Mono-bugs] [Bug 623477] Different behavior on Thread(ThreadEntryPoint, maxStackSize) on .net and mono">bugzilla_noreply at novell.com
</A><BR>
<I>Tue Jul 20 02:55:59 EDT 2010</I>
<P><UL>
<LI>Previous message: <A HREF="102360.html">[Mono-bugs] [Bug 623477] Different behavior on Thread(ThreadEntryPoint, maxStackSize) on .net and mono
</A></li>
<LI>Next message: <A HREF="102318.html">[Mono-bugs] [Bug 623483] New: SVN Mono regression, cannot define sum types in F# interactive
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#102361">[ date ]</a>
<a href="thread.html#102361">[ thread ]</a>
<a href="subject.html#102361">[ subject ]</a>
<a href="author.html#102361">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="http://bugzilla.novell.com/show_bug.cgi?id=623477">http://bugzilla.novell.com/show_bug.cgi?id=623477</A>
<A HREF="http://bugzilla.novell.com/show_bug.cgi?id=623477#c4">http://bugzilla.novell.com/show_bug.cgi?id=623477#c4</A>
--- Comment #4 from Torello Querci &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">tquerci at gmail.com</A>&gt; 2010-07-20 06:55:58 UTC ---
Moreover,
on windows platform there is a minimum value of Stack Size that it's assigned
even if the application ask for less memory.
In the official documentation there is write:
&quot;If maxStackSize is less than the minimum stack size, the minimum stack size is
used. If maxStackSize is not a multiple of the page size, it is rounded to the
next larger multiple of the page size. For example, if you are using the .NET
Framework version 2.0 on Microsoft Windows Vista, 256KB (262144 bytes) is the
minimum stack size, and the page size is 64KB (65536 bytes).
&quot;
So to have the same behavior on mono that we have on .net we can assume to have
the same stack size.
Personally I not like this solution because I prefer to have the exact memory
that I ask but in this case some assembly can not able to run, so the patch can
became something like this one:
Index: class/corlib/System.Threading/Thread.cs
===================================================================
--- class/corlib/System.Threading/Thread.cs (revisione 159957)
+++ class/corlib/System.Threading/Thread.cs (copia locale)
@@ -976,8 +976,12 @@
{
if (start == null)
throw new ArgumentNullException (&quot;start&quot;);
- if (maxStackSize &lt; 131072)
- throw new ArgumentException (&quot;&lt; 128 kb&quot;, &quot;maxStackSize&quot;);
+ if (maxStackSize &lt; 0)
+ throw new ArgumentException (&quot;&lt; 0 kb&quot;, &quot;maxStackSize&quot;);
+ if (maxStackSize &lt; 262144)
+ maxStackSize = 262144;
+ if ((maxStackSize | 0xffff) != 0)
+ maxStackSize = (maxStackSize | 0xffff)+0xffff;
threadstart = start;
Internal.stack_size = maxStackSize;
@@ -995,8 +999,12 @@
{
if (start == null)
throw new ArgumentNullException (&quot;start&quot;);
- if (maxStackSize &lt; 131072)
- throw new ArgumentException (&quot;&lt; 128 kb&quot;, &quot;maxStackSize&quot;);
+ if (maxStackSize &lt; 0)
+ throw new ArgumentException (&quot;&lt; 0 kb&quot;, &quot;maxStackSize&quot;);
+ if (maxStackSize &lt; 262144)
+ maxStackSize = 262144;
+ if ((maxStackSize | 0xffff) != 0)
+ maxStackSize = (maxStackSize | 0xffff)+0xffff;
threadstart = start;
Internal.stack_size = maxStackSize;
--
Configure bugmail: <A HREF="http://bugzilla.novell.com/userprefs.cgi?tab=email">http://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="102360.html">[Mono-bugs] [Bug 623477] Different behavior on Thread(ThreadEntryPoint, maxStackSize) on .net and mono
</A></li>
<LI>Next message: <A HREF="102318.html">[Mono-bugs] [Bug 623483] New: SVN Mono regression, cannot define sum types in F# interactive
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#102361">[ date ]</a>
<a href="thread.html#102361">[ thread ]</a>
<a href="subject.html#102361">[ subject ]</a>
<a href="author.html#102361">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>