Re: [Mono-dev] Malloc issue?

2012-08-24 Thread Greg Young
Will take a look. Not sure what it may not be liking. Code is very basic. Literally allocates 16mb chunk then frees it (each object has one) code works fine in windows with same calls. Will debug it on Sunday. On Friday, August 24, 2012, Jonathan Pryor wrote: On Aug 23, 2012, at 2:35 AM, Greg

Re: [Mono-dev] Malloc issue?

2012-08-24 Thread Jonathan Pryor
On Aug 23, 2012, at 2:35 AM, Greg Young gregoryyou...@gmail.com wrote: We are allocating and releasing unmanaged memory with marshal.allochglobal. In mono we are getting the following failure (no failures under clr). Any ideas? That's not a mono error, that's a glibc assert (and thus cannot

Re: [Mono-dev] Malloc issue?

2012-08-24 Thread Rodrigo Kumpera
This crash is either a bug on glibc malloc, which I find to be the less likely, or a bug on mono or your app. Run it under the many malloc debugging tools that malloc(3) has or with a tool such as valgrind - it will very easily spot a memory overrun in mono/your app. On Fri, Aug 24, 2012 at

Re: [Mono-dev] Why does .NET object lifetime not extend into an instance method call?

2012-08-24 Thread Jonathan Pryor
On Aug 24, 2012, at 1:11 PM, David Jeske dav...@gmail.com wrote: (1) Why would a call to an instance method not hold this alive for the entire duration of the call? `this` isn't special, it's just an implicit variable passed into the method. If the variable isn't used within the method call,

Re: [Mono-dev] Why does .NET object lifetime not extend into an instance method call?

2012-08-24 Thread David Jeske
On Fri, Aug 24, 2012 at 10:50 AM, Jonathan Pryor jonpr...@vt.edu wrote: It seems this could happen in more cases than just PInvoke. This seems to allow a finalizer to run before an object is done being used anytime the object instance is not stored. (i.e. inside a statement of the form new

Re: [Mono-dev] Why does .NET object lifetime not extend into an instance method call?

2012-08-24 Thread Lepisto, Stephen P
Am I wrong in thinking that in void Problem() { mo.doSomething(); } mo is contained within the context of the method body of Problem() and therefore cannot be disposed of until the method body of Problem() has done execution. This means that mo will continue to live for the life of the

Re: [Mono-dev] Why does .NET object lifetime not extend into an instance method call?

2012-08-24 Thread Diego Frata
mo actually is this.mo, so you do have a reference for this. Diego Frata diego.fr...@gmail.com On Fri, Aug 24, 2012 at 5:47 PM, Lepisto, Stephen P stephen.p.lepi...@intel.com wrote: Am I wrong in thinking that in ** ** void Problem() { mo.doSomething(); } ** ** mo is

Re: [Mono-dev] Why does .NET object lifetime not extend into an instance method call?

2012-08-24 Thread David Jeske
On Fri, Aug 24, 2012 at 8:31 PM, Jonathan Pryor jonpr...@vt.edu wrote: I'm sorry for my naivety. Why does allowing unused function arguments to be collected before a function returns have such important effects on memory usage? Java. :-) The context is the JVM, and large methods. Many JVM

Re: [Mono-dev] Why does .NET object lifetime not extend into an instance method call?

2012-08-24 Thread Jonathan Pryor
On Aug 24, 2012, at 4:26 PM, David Jeske dav...@gmail.com wrote: Thanks very mych for the detailed reply. It seems to me there is a race that has nothing to do with native code. Native code just makes it easier to reason about, but as you mention it is quite applicable to managed code. My