Re: Memory...growing, and growing

2007-01-14 Thread Marcus Holland-Moritz
On 2007-01-14, at 11:15:33 +0100, Rafael Garcia-Suarez wrote: > On 13/01/07, Marvin Humphrey <[EMAIL PROTECTED]> wrote: > > It's been a couple days with no response to this, so it looks like > > I've been Warnocked. Not too surprising, as this very small memory > > leak affects very few people:

Re: Memory...growing, and growing

2007-01-14 Thread Rafael Garcia-Suarez
On 13/01/07, Marvin Humphrey <[EMAIL PROTECTED]> wrote: It's been a couple days with no response to this, so it looks like I've been Warnocked. Not too surprising, as this very small memory leak affects very few people: people using Valgrind to debug XS modules, possibly people embedding Perl.

Re: Memory...growing, and growing

2007-01-13 Thread Marvin Humphrey
On Jan 10, 2007, at 2:45 PM, Marvin Humphrey wrote: However, before I do that, I'd like to know whether DL_UNLOAD_ALL_AT_EXIT should be defined more often. Should DEBUGGING turn it on? If so then there's no need to patch perlhack. Or should it be on all the time? IIUC, not cleaning up

Re: Memory...growing, and growing

2007-01-10 Thread Marvin Humphrey
On Jan 8, 2007, at 12:42 PM, Nicholas Clark wrote: On Mon, Jan 08, 2007 at 12:23:09PM -0800, Marvin Humphrey wrote: Unfortunately, I've never succeeded in banishing all of Perl's leaks when debugging XS under either 5.8.8 or 5.9.4. Now that we're having this discussion, I will attempt to wri

Re: Memory...growing, and growing

2007-01-08 Thread Marvin Humphrey
On Jan 8, 2007, at 1:14 PM, Dan Sully wrote: ==30258== 436 (112 direct, 324 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 16 ==30258==at 0x4A2080E: malloc (vg_replace_malloc.c:149) ==30258==by 0x56CC911: CRYPTO_malloc (in /usr/lib/libcrypto.so. 0.9.8) ==30258=

Re: Memory...growing, and growing

2007-01-08 Thread Marvin Humphrey
On Jan 8, 2007, at 12:42 PM, Nicholas Clark wrote: On Mon, Jan 08, 2007 at 12:23:09PM -0800, Marvin Humphrey wrote: Unfortunately, I've never succeeded in banishing all of Perl's leaks when debugging XS under either 5.8.8 or 5.9.4. Now that we're having this discussion, I will attempt to wri

Re: Memory...growing, and growing

2007-01-08 Thread Marvin Humphrey
On Jan 8, 2007, at 1:14 PM, Dan Sully wrote: ==30258== 436 (112 direct, 324 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 16 ==30258==at 0x4A2080E: malloc (vg_replace_malloc.c:149) ==30258==by 0x56CC911: CRYPTO_malloc (in /usr/lib/libcrypto.so. 0.9.8) ==30258=

Re: Memory...growing, and growing

2007-01-08 Thread Dan Sully
* Marvin Humphrey shaped the electrons to say... The one thing that looks weird is this, in sv_bio_final(): if (!sv) { sv = &PL_sv_undef; } That was just in the for debugging, I commented it out and still have the leak behavior. valgrind reports this: ==30258=

Re: Memory...growing, and growing

2007-01-08 Thread Nicholas Clark
On Mon, Jan 08, 2007 at 12:23:09PM -0800, Marvin Humphrey wrote: > Unfortunately, I've never succeeded in banishing all of Perl's leaks > when debugging XS under either 5.8.8 or 5.9.4. Now that we're having > this discussion, I will attempt to write up a test case illustrating > the problem

Re: Memory...growing, and growing

2007-01-08 Thread Marvin Humphrey
On Jan 8, 2007, at 11:30 AM, Dan Sully wrote: * Marvin Humphrey shaped the electrons to say... I think you'll need to look elsewhere. Coincidentally, I'm debugging memory leaks right this moment using valgrind. If you have access to a Linux system, I'd strongly recommend you give it

Re: Memory...growing, and growing

2007-01-08 Thread Dan Sully
* Marvin Humphrey shaped the electrons to say... I think you'll need to look elsewhere. Coincidentally, I'm debugging memory leaks right this moment using valgrind. If you have access to a Linux system, I'd strongly recommend you give it a try. Any suggestions for using valgrind with Perl

Re: Memory...growing, and growing

2007-01-08 Thread Alberto Simões
Your handling of the perl array looks correct. You create a new AV with a refcount of one. You add a bunch of scalars to the array, each of which is created with a refcount of 1. Crucially, you handle the arrayref correctly, creating a single reference which does not increase the refcount of

Re: Memory...growing, and growing

2007-01-08 Thread Marvin Humphrey
On Jan 8, 2007, at 10:16 AM, Alberto Simões wrote: array = newAV(); av_push(array, newSVuv(dictionary_get_occ(D, wid))); for (j = 0; j < MAXENTRY; j++) { twid = 0; prob = 0.0; twid = dictionary_get_id(D, wid, j); if (twid) {

Re: Memory...growing, and growing

2007-01-08 Thread Alberto Simões
Marvin Humphrey wrote: On Jan 8, 2007, at 10:26 AM, Nicholas Clark wrote: Am I doing something wrong? Maybe because of refcounts and such? Yes, I think so. (But I'm not the expert on these) >8 snip 8< RETVAL = sv_2mortal(newRV_noinc((SV*)array)); /me .oO( wow, how often do

Re: Memory...growing, and growing

2007-01-08 Thread Nicholas Clark
On Mon, Jan 08, 2007 at 10:39:57AM -0800, Marvin Humphrey wrote: > > On Jan 8, 2007, at 10:26 AM, Nicholas Clark wrote: > > >>Am I doing something wrong? Maybe because of refcounts and such? > > > >Yes, I think so. (But I'm not the expert on these) > > >8 snip 8< > > > RETVAL = sv_2

Re: Memory...growing, and growing

2007-01-08 Thread Marvin Humphrey
On Jan 8, 2007, at 10:26 AM, Nicholas Clark wrote: Am I doing something wrong? Maybe because of refcounts and such? Yes, I think so. (But I'm not the expert on these) >8 snip 8< RETVAL = sv_2mortal(newRV_noinc((SV*)array)); /me .oO( wow, how often do you get to correct D

Re: Memory...growing, and growing

2007-01-08 Thread Nicholas Clark
On Mon, Jan 08, 2007 at 06:16:57PM +, Alberto Simões wrote: > Hi > > I am trying to debug some code that is using too much memory. I am not > sure if it is from the XS code, but if you say it isn't at least I know > I should look elsewhere. > > Here it is (resumed): > >array = newAV();