Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

GDBM_File fix...

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


lists.perl.perl5-porters at csjewell

Nov 7, 2009, 10:30 AM

Post #1 of 5 (84 views)
Permalink
GDBM_File fix...

One of the things we'd like to include in Strawberry for January (it's
been requested - the people writing the Koha integrated library system
want it) is the GDBM_File module and the libraries to make it work.

I just recieved this patch (I just massaged it into one that applies to
blead) from kmx, and it works for us and the compiled gdbm library we'd
like to include. [It does not compile for us otherwise.]

I know it's not workable as is (It'd be appropriate to minimize the
change with the appropriate #ifdefs) but I'm sending it here for
comments and improvement.

Please?

--Curtis Jewell
--
Curtis Jewell
csjewell[at]cpan.org http://csjewell.dreamwidth.org/
perl[at]csjewell.fastmail.us http://csjewell.comyr.org/perl/

"Your random numbers are not that random" -- perl-5.10.1.tar.gz/util.c

Strawberry Perl for Windows betas: http://strawberryperl.com/beta/
Attachments: 0001-Proposed-patch-to-make-GDBM_File-work-with-Strawberr.patch (0.65 KB)


lists.perl.perl5-porters at csjewell

Nov 7, 2009, 11:03 AM

Post #2 of 5 (81 views)
Permalink
Re: GDBM_File fix... [In reply to]

wrong pool ..." when calling free(str)

--Curtis

On Sat, 07 Nov 2009 11:30 -0700, "Curtis Jewell"
<lists.perl.perl5-porters[at]csjewell.fastmail.us> wrote:
> One of the things we'd like to include in Strawberry for January (it's
> been requested - the people writing the Koha integrated library system
> want it) is the GDBM_File module and the libraries to make it work.
>
> I just recieved this patch (I just massaged it into one that applies to
> blead) from kmx, and it works for us and the compiled gdbm library we'd
> like to include. [It does not compile for us otherwise.]
>
> I know it's not workable as is (It'd be appropriate to minimize the
> change with the appropriate #ifdefs) but I'm sending it here for
> comments and improvement.
>
> Please?
>
> --Curtis Jewell
> --
> Curtis Jewell
> csjewell[at]cpan.org http://csjewell.dreamwidth.org/
> perl[at]csjewell.fastmail.us http://csjewell.comyr.org/perl/
>
> "Your random numbers are not that random" -- perl-5.10.1.tar.gz/util.c
>
> Strawberry Perl for Windows betas: http://strawberryperl.com/beta/
>
--
Curtis Jewell
csjewell[at]cpan.org http://csjewell.dreamwidth.org/
perl[at]csjewell.fastmail.us http://csjewell.comyr.org/perl/

"Your random numbers are not that random" -- perl-5.10.1.tar.gz/util.c

Strawberry Perl for Windows betas: http://strawberryperl.com/beta/


nick at ccl4

Nov 7, 2009, 11:08 AM

Post #3 of 5 (81 views)
Permalink
Re: GDBM_File fix... [In reply to]

On Sat, Nov 07, 2009 at 12:03:36PM -0700, Curtis Jewell wrote:
> kmx> without this patch GDBM_File tests ended with an error: "Free to
> wrong pool ..." when calling free(str)

On the assumption that the patch solved something, I'd figured out that this
would be the problem.

What in the perl source code is redefining free?
Is there any "official" way to get back to the system's free?

Nicholas Clark


steve.m.hay at googlemail

Nov 7, 2009, 5:58 PM

Post #4 of 5 (74 views)
Permalink
Re: GDBM_File fix... [In reply to]

2009/11/7 Nicholas Clark <nick[at]ccl4.org>:
> On Sat, Nov 07, 2009 at 12:03:36PM -0700, Curtis Jewell wrote:
>> kmx>    without this patch GDBM_File tests ended with an error: "Free to
>> wrong pool ..." when calling free(str)
>
> On the assumption that the patch solved something, I'd figured out that this
> would be the problem.
>
> What in the perl source code is redefining free?

XSUB.h, iperlsys.h and win32iop.h.

XSUB.h defines free as PerlMem_free. Then iperlsys.h defines
PerlMem_free(buf) as either (*PL_Mem->pFree)(PL_Mem, (buf)) or as
free((buf)) if PERL_IMPLICIT_SYS is defined or not respectively. In
the latter case, win32iop.h then defines free as win32_free (because
WIN32IO_IS_STDIO is not defined in win32.h in this case). In the
former (PERL_IMPLICIT_SYS) case the *PL_Mem->pFree call goes through
the perlhost layer and in this case lands up in VMem::Free() in
vmem.h, which is where the Free to wrong pool comes from.


> Is there any "official" way to get back to the system's free?

I don't know. In the case of IO functions there are SIO names (e.g.
PerlSIO_fopen()) for accessing the original system calls, but I don't
see a similar set-up for malloc/free.


perl at profvince

Nov 8, 2009, 1:50 AM

Post #5 of 5 (69 views)
Permalink
Re: GDBM_File fix... [In reply to]

> What in the perl source code is redefining free?
> Is there any "official" way to get back to the system's free?
>
It is #defined in win32iop.h to win32_free, which itself calls the
system free().

Time::Piece and POSIX also #undef free, with the following insightful
comment :

* We also #undef malloc() and free() to be sure we are using the CRT
* functions otherwise under PERL_IMPLICIT_SYS they are redefined to calls
* into VMem::Malloc() and VMem::Free() and all allocations will be freed
* when the Perl interpreter is being destroyed so we'd end up with a
pointer
* into deallocated memory in environ[] if a program embedding a Perl
* interpreter continues to operate even after the main Perl interpreter has
* been destroyed.


Vincent.

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.