Re: [Mono-list] Checking memory leak

2009-04-25 Thread Ishwor Gurung
Hi Andreas,

On Thu, 23 Apr 2009 05:41:09 pm Andreas Ericsson wrote:
> Ishwor Gurung wrote:
> > Hi list,
> >
> > Whats an appropriate way to check for memory leak of a mono application?
> >
> > I googled around with some example using valgrind for mono app but
> > couldn't find any concrete examples. What I've essentially done so far
> > using valgrind is:
> > $ valgrind --tool=memcheck --leak-check=full --show-reachable=yes mono
> > ./ConnectUTest.exe
> >
> > This however, always produces memory leak (~14k/test on five runs so
> > far):
> >
> > ==15141== LEAK SUMMARY:
> > ==15141==definitely lost: 14,408 bytes in 760 blocks.
> > ==15141==indirectly lost: 2,496 bytes in 126 blocks.
> > ==15141==  possibly lost: 12,460 bytes in 419 blocks.
> > ==15141==still reachable: 2,569,056 bytes in 16,726 blocks.
> > ==15141== suppressed: 0 bytes in 0 blocks.
> >
> >
> > Is this something I should worry about in itself or let the Mono's GC
> > do its job with the memory and not worry about memory leaks? Can
> > someone confirm if these are even a real memory leak (the one above
> > with 14,408 bytes gone!)?
>
> If valgrind reports it as a leak, then it is a leak, but only in the
> sense that no reference points *exactly* to the leaked area.
>
> For example, consider this code (in C, sorry. I don't know how to
> produce a leak in C#):
>
> --%<--%<--
> static unsigned long offset;
> static char *buf;
>
> void some_func(void)
> {
>   buf = malloc(5000);
>   offset = 4500;
>   buf += offset;
> }
> --%<--%<--
>
> but that's not entirely true, because the exact reference to *buf
> can be determined by
>
>   exact_ref = buf - offset;

Yep.

> Granted, this is a pretty weird way of using offsets, but it's a
> valid one that can be done without leaking memory. I've sometimes
> used it myself to microoptimize tight loops, but only on static
> sized data where the offset is always
>
>   exact_ref = buf - STATIC_SIZE;

Yep

> In short; Valgrind sometimes gives false positives. So long as
> the leaked memory is small-ish (14K is nothing) and doesn't
> grow over time, I wouldn't worry about it.

Yep I haven't done hardcore regression on it yet but yeah I'd assume ~14k is 
OK for now. Let me code few more functions and see in the future. Thanks.

-- 
Cheers,
Ishwor Gurung


signature.asc
Description: This is a digitally signed message part.
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Mono Winforms rendered to memory buffer

2009-04-25 Thread krippy2k

Hi all,

I'm not sure if this is the correct list, but here goes.

I've got Mono embedded in a game engine for game "scripting", and that works
fantastic. Now I'm wondering if I can leverage it for something else. It
would be interesting to use some of the Winforms controls in the game engine
GUI as well.

Is there a way to use Mono/Winforms in a way that will render everything to
a memory buffer? I'm sure it's possible since we have the source code, but
anything that will help steer me in the right direction to get started with
this would be mucho appreciated.

Thanks,
Gerald

-- 
View this message in context: 
http://www.nabble.com/Mono-Winforms-rendered-to-memory-buffer-tp23237341p23237341.html
Sent from the Mono - General mailing list archive at Nabble.com.

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] MarshalByRefObject

2009-04-25 Thread Robert Jordan
fozzie wrote:
> Hi all...
> 
> I'm returning a MarshalByRefObject from c# to mono_runtime_invoke() - do I
> need to reference it via gc_handle_new()? 

MBRs are not different with respect to GC.

Robert

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] MarshalByRefObject

2009-04-25 Thread fozzie

Hi all...

I'm returning a MarshalByRefObject from c# to mono_runtime_invoke() - do I
need to reference it via gc_handle_new()? 
-- 
View this message in context: 
http://www.nabble.com/MarshalByRefObject-tp23236482p23236482.html
Sent from the Mono - General mailing list archive at Nabble.com.

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] HTTP file download

2009-04-25 Thread Robert Jordan
giancarlogiesa wrote:
> Hello,
> 
> is possible with C# / Mono download a file from an HTTP server ?
> if yes, how ?

WebClient wc = new WebClient();
byte[] content = wc.DownloadData(url);

or

wc.DownloadFile(url, fileName).

Just look at WebClient docs.

Robert

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] HTTP file download

2009-04-25 Thread giancarlogiesa

Hello,

is possible with C# / Mono download a file from an HTTP server ?
if yes, how ?

my code is this:

private string SocketSendReceive(string url){
int i=0;
while(i 0);
i=2;
while(ihttp://www.nabble.com/HTTP-file-download-tp23224875p23224875.html
Sent from the Mono - General mailing list archive at Nabble.com.

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] failing to build mono (trunk svn rev 132609 or 132612) SqlStatementBuilder.cs

2009-04-25 Thread Basile Starynkevitch

Hello All

I am trying to build the latest mono svn on Debian/testing/AMD64, where the
Debian-installed /usr/bin/mono is Mono JIT compiler version 2.0.1 (tarball),
and /usr/bin/gmcs is Mono C# compiler version 2.0.1.0 and /usr/bin/gcc is 
x86_64-linux-gnu gcc version 4.3.3 (Debian 4.3.3-3)

The svn info for libgdiplus gives URL:
http://anonsvn.mono-project.com/source/trunk/libgdiplus revision 132612. For
mcs gives http://anonsvn.mono-project.com/source/trunk/mcs revision 132612.
For mono gives  http://anonsvn.mono-project.com/source/trunk/mono revision
132612. For xsp gives http://anonsvn.mono-project.com/source/trunk/xsp
revision 131454. All the above are svn checkouted in the same parent
/usr/src/Mono directory.

So I go into the mono subdirectory and run % ./autogen.sh --with-jit  
--enable-parallel-mark because I want to test the JIT and parallel mark GC
features.

Then I run make, and I am getting stuck with
make[8]: Entering directory `/usr/src/Mono/mcs/class/System.Data.Linq' 

MCS [net_2_0] System.Data.Linq.dll 

src/DbLinq/Data/Linq/Sql/SqlStatementBuilder.cs(125,53): error CS1526: A new
expression requires () or [] after type

src/DbLinq/Util/TextWriterExtension.cs(103,85): error CS1526: A new
expression requires () or [] after type

src/DbLinq/Util/TextWriterExtension.cs(111,85): error CS1526: A new
expression requires () or [] after type


etc.

The same error happenned with previous svn rev 132609.

Do you have any ideas about what I am doing wrong?

Regards.


-- 

Basile STARYNKEVITCH  http://starynkevitch.net/Basile/ 
http://starynkevitch.net/Basile/  

email: basile-at-starynkevitch-dot-net mobile: +33 6 8501 2359 

8, rue de la Faiencerie, 92340 Bourg La Reine, France 

*** opinions {are only mines, sont seulement les miennes} ***










-- 
View this message in context: 
http://www.nabble.com/failing-to-build-mono-%28trunk-svn-rev-132609-or-132612%29-SqlStatementBuilder.cs-tp23223470p23223470.html
Sent from the Mono - General mailing list archive at Nabble.com.
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Welcome Summer of Code 2009 Students!

2009-04-25 Thread Olexandr Melnyk
On Sat, Apr 25, 2009 at 2:05 PM, Olexandr Melnyk  wrote:
> 2009/4/23 Rodrigo Cuevas :
>
> PL/Mono awesome project

Just as awesome as other ones, we're surely going to have a fun summer. :)

Too bad that there are only nine Mono students this year.

--
Sincerely yours,
Olexandr Melnyk
http://omelnyk.net/
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list