Re: debugging a memory leak

2016-05-20 Thread Valery Ushakov
Timo Buhrmester  wrote:

> > but it's limited to Linux, Darwin, and Solaris.
> 
> Last time I checked, FreeBSD also had valgrind working.  I wonder
> how much effort it would be to port it to NetBSD.

As far as I understand (I had my brushes with valgrind internals) it's
mostly the drudgery of, effectively, writing code that annotates all
the system calls and all ioctls.  And that's not fun, obviously.

-uwe



Re: debugging a memory leak

2016-05-20 Thread Swift Griggs
On Fri, 20 May 2016, Manuel Bouyer wrote:
> I though ElectricFence would only detect things like use after free or 
> out of bound access, but not memory leaks ?

Hmm, I thought it did. Like if you try to malloc() over a pointer and 
clobber it before you free()'d the previous one (say in a loop/iterative 
situation). A ghetto reference counter + LD_PRELOAD works pretty well for 
that, too. The only problem is that it makes your app fairly slow for 
testing if it does a lot of dynamic allocation. Neither approach is near 
as good as Valgrind, for sure.

-Swift



Re: debugging a memory leak

2016-05-20 Thread Manuel Bouyer
On Fri, May 20, 2016 at 10:29:02PM +0200, Timo Buhrmester wrote:
> > but it's limited to Linux, Darwin, and Solaris.
> Last time I checked, FreeBSD also had valgrind working.  I wonder how
> much effort it would be to port it to NetBSD.

google found some talks about it for NetBSD but it seems the task
was never completed.

-- 
Manuel Bouyer 
 NetBSD: 26 ans d'experience feront toujours la difference
--


Re: debugging a memory leak

2016-05-20 Thread Manuel Bouyer
On Fri, May 20, 2016 at 02:20:39PM -0600, Swift Griggs wrote:
> On Fri, 20 May 2016, Manuel Bouyer wrote:
> > what tools do we have on NetBSD to find a memory leak in a userland 
> > program (actually OpenCPN - which is a large C++ program with dynamic 
> > libraries and uses dlopen()) ?
> 
> Manuel, I'm guessing you are a much better C programmer than I, but I can 
> relate what I use. I do three different things:
> 
> 1. If it'll compile on Linux, I'll test it with valgrind and just apply 
> the results on the NetBSD side. 

I tried this, as opencpn is developed for linux. It builds and runs,
but the plugins won't load, the main application lacks some symbols
(but not all !). 
I'm not seeing the lack on Linux; I've not tried running without the
plugins on NetBSD yet.

> 
> 2. ElectricFence, but I doubt it'd work with libs dlopen()'d. Then again, 
> if you used it with LD_PRELOAD you might be able to pre-empt the symbols 
> even in the dynamic libs (in theory). 

I though ElectricFence would only detect things like use after free or
out of bound access, but not memory leaks ?

> 
> 3. I created a cheeseball reference counter similar to the one in glib by 
> just wrappering malloc(). It just add/drops/prints a linked list of 
> structs which are entries I'm tracking. When everything is working 
> perfectly, I remove it. Voila clean memory management without krufty 
> GC overhead! 
> 
> > The memory usage of the process is slowy growing, until the systems gets 
> > out of ram/swap and kills it (on my evbarm which has no swap it takes 
> > about 2 days).
> 
> My guess (which ain't worth much, take it with a grain of salt) you'd find 
> it pretty darn fast with valgrind. It's never failed me, but it's limited 
> to Linux, Darwin, and Solaris.

Yes, valgrind was my first idea. I guess I'll have to debug this
hidden symbols problem...

-- 
Manuel Bouyer 
 NetBSD: 26 ans d'experience feront toujours la difference
--


Re: debugging a memory leak

2016-05-20 Thread Timo Buhrmester
> but it's limited to Linux, Darwin, and Solaris.
Last time I checked, FreeBSD also had valgrind working.  I wonder how
much effort it would be to port it to NetBSD.


Re: debugging a memory leak

2016-05-20 Thread Swift Griggs
On Fri, 20 May 2016, Manuel Bouyer wrote:
> what tools do we have on NetBSD to find a memory leak in a userland 
> program (actually OpenCPN - which is a large C++ program with dynamic 
> libraries and uses dlopen()) ?

Manuel, I'm guessing you are a much better C programmer than I, but I can 
relate what I use. I do three different things:

1. If it'll compile on Linux, I'll test it with valgrind and just apply 
the results on the NetBSD side. 

2. ElectricFence, but I doubt it'd work with libs dlopen()'d. Then again, 
if you used it with LD_PRELOAD you might be able to pre-empt the symbols 
even in the dynamic libs (in theory). 

3. I created a cheeseball reference counter similar to the one in glib by 
just wrappering malloc(). It just add/drops/prints a linked list of 
structs which are entries I'm tracking. When everything is working 
perfectly, I remove it. Voila clean memory management without krufty 
GC overhead! 

> The memory usage of the process is slowy growing, until the systems gets 
> out of ram/swap and kills it (on my evbarm which has no swap it takes 
> about 2 days).

My guess (which ain't worth much, take it with a grain of salt) you'd find 
it pretty darn fast with valgrind. It's never failed me, but it's limited 
to Linux, Darwin, and Solaris.

-Swift



Re: NetBSD 7, i386, firefox with flash plugin?

2016-05-20 Thread Jose Luis Rodriguez Garcia
I haven't more ideas.
I know that in the previous pkgsrc version, recent firefox didn't
build. You had to use firefox24-24.

In the recent pkgsrc firefox now builds fine. I am using now firefos
38 (it is the ESR version).

I think that you have mixed packages from different versions of
pkgsrc. Delete all the packages , and install all from zero with
pkgin.

These are my versions, if it can help you:

pc2$ pkg_info|egrep 'firefox|flash|nspluginwrapper'
nspluginwrapper-1.4.4 Use Netscape compatible plugins from other platforms
firefox24-24.8.1nb6 Web browser with support for extensions (version 24.x)
libflashsupport-4.2.2011 Additional Interface Support for Linux Flash Player
adobe-flash-plugin-11.2.202.559 Adobe Flash Player Browser plugin
firefox38-38.7.1Web browser with support for extensions (version 38)

I have also this entry for linux emulation in /etc/fstab:
procfs/procprocfsrw
tmpfs/var/shmtmpfsrw,-m1777,-sram%25

(I think the last one rarely is needed).


On Fri, May 20, 2016 at 7:16 PM, Mayuresh  wrote:
> On Fri, May 20, 2016 at 09:11:11PM +0530, Mayuresh wrote:
>> On Fri, May 20, 2016 at 05:04:55PM +0200, Jose Luis Rodriguez Garcia wrote:
>> > I think that it matters.
>> >
>> > f you use pkgin try to update all packages: pkgin upgrade. If you
>> > don't use pkgin, you can try to use pkg_add -u on firefox and
>> > npwrapper.
>>
>> I prefer pkgin whenever packages are available and I do not need different
>> options. But when I installed last week firefox wasn't available.
>> I'll try now. It seems there now.
>>
>> (Unfortunately the pkgin version comes with pulseaudio which I don't
>> prefer. I'll anyway try.)
>
> Installed everything from pkgin now. Some packages like icu had higher
> version as I compiled it using pkgsrc. Recursively deleted it and synced
> everything with pkgin.
>
> The problem still persists.
>
>
>
> Badly stuck. Would appreciate help to solve this.
>
>
> Mayuresh


Re: NetBSD 7, i386, firefox with flash plugin?

2016-05-20 Thread Mayuresh
On Fri, May 20, 2016 at 09:11:11PM +0530, Mayuresh wrote:
> On Fri, May 20, 2016 at 05:04:55PM +0200, Jose Luis Rodriguez Garcia wrote:
> > I think that it matters.
> > 
> > f you use pkgin try to update all packages: pkgin upgrade. If you
> > don't use pkgin, you can try to use pkg_add -u on firefox and
> > npwrapper.
> 
> I prefer pkgin whenever packages are available and I do not need different
> options. But when I installed last week firefox wasn't available.
> I'll try now. It seems there now.
> 
> (Unfortunately the pkgin version comes with pulseaudio which I don't
> prefer. I'll anyway try.)

Installed everything from pkgin now. Some packages like icu had higher
version as I compiled it using pkgsrc. Recursively deleted it and synced
everything with pkgin.

The problem still persists.



Badly stuck. Would appreciate help to solve this.


Mayuresh


Re: NetBSD 7, i386, firefox with flash plugin?

2016-05-20 Thread Mayuresh
On Fri, May 20, 2016 at 05:04:55PM +0200, Jose Luis Rodriguez Garcia wrote:
> I think that it matters.
> 
> f you use pkgin try to update all packages: pkgin upgrade. If you
> don't use pkgin, you can try to use pkg_add -u on firefox and
> npwrapper.

I prefer pkgin whenever packages are available and I do not need different
options. But when I installed last week firefox wasn't available.
I'll try now. It seems there now.

(Unfortunately the pkgin version comes with pulseaudio which I don't
prefer. I'll anyway try.)

> I think that you have mixed versions (some packages have dependencies
> of older packages).
> 
> As workaround you can try to do a symlink of libX11, but I think that
> the libX11 is from
>  linux (under /emul/linux/...), not the NetBSD one. (the flasplayer is
> a linux library).

libX11.so.6 is present under /emul/linux, despite that the error comes. So
I tried symlinking (which I think one should not do normally). But that
did not help.

Mayuresh.


Re: NetBSD 7, i386, firefox with flash plugin?

2016-05-20 Thread Jose Luis Rodriguez Garcia
I think that it matters.

f you use pkgin try to update all packages: pkgin upgrade. If you
don't use pkgin, you can try to use pkg_add -u on firefox and
npwrapper.

I think that you have mixed versions (some packages have dependencies
of older packages).

As workaround you can try to do a symlink of libX11, but I think that
the libX11 is from
 linux (under /emul/linux/...), not the NetBSD one. (the flasplayer is
a linux library).

On Fri, May 20, 2016 at 3:47 PM, Mayuresh  wrote:
> On Fri, May 20, 2016 at 03:41:27PM +0200, Jose Luis Rodriguez Garcia wrote:
>> I use it without problems in NetBSD 7.0/amd64 and NetBSD 6.1/i386.
>
> Yes, it looks like:
>
> Shockwave Flash
>
> File: npwrapper.libflashplayer.so
> Path: /usr/pkg/lib/netscape/plugins/npwrapper.libflashplayer.so
> Version:
> State: Enabled
> Shockwave Flash 11.2 r202
>
> MIME Type   Description Suffixes
> application/x-shockwave-flash   Shockwave Flash swf
> application/futuresplashFutureSplash Player spl
>
>
>> When you try play a flash file what is the error message?
>
> Nothing on the terminal where I launch firefox.
>
> In flash area: "An error occurred. Please try again later."
>
> I got to see "libX11.so.6 not found" or something like that message once,
> but that is not getting reproduced (strangely).
>
> I have libX11.so.7. But I saw mail threads that say above error should not
> matter.
>
> Mayuresh.


Re: NetBSD 7, i386, firefox with flash plugin?

2016-05-20 Thread Jose Luis Rodriguez Garcia
I use it without problems in NetBSD 7.0/amd64 and NetBSD 6.1/i386.

Does it appear in the list of registered plugins, In firefox type: about:plugins

When you try play a flash file what is the error message?

On Mon, May 16, 2016 at 08:07:22PM +0530, Mayuresh wrote:

>Can someone please help? Any way out to get flash work in any browser on
NetBSD 7.0 i386?

>Does it work on amd64? (Did I make a mistake by switching to i386?)

>Mayuresh


Re: NetBSD 7, i386, firefox with flash plugin?

2016-05-20 Thread Mayuresh
On Fri, May 20, 2016 at 03:41:27PM +0200, Jose Luis Rodriguez Garcia wrote:
> I use it without problems in NetBSD 7.0/amd64 and NetBSD 6.1/i386.

Yes, it looks like:

Shockwave Flash

File: npwrapper.libflashplayer.so
Path: /usr/pkg/lib/netscape/plugins/npwrapper.libflashplayer.so
Version: 
State: Enabled
Shockwave Flash 11.2 r202

MIME Type   Description Suffixes
application/x-shockwave-flash   Shockwave Flash swf
application/futuresplashFutureSplash Player spl


> When you try play a flash file what is the error message?

Nothing on the terminal where I launch firefox.

In flash area: "An error occurred. Please try again later."

I got to see "libX11.so.6 not found" or something like that message once,
but that is not getting reproduced (strangely).

I have libX11.so.7. But I saw mail threads that say above error should not
matter.

Mayuresh.