Front page | perl.perl5.porters |
Postings from April 2012
[perl #9319] Perl bug -- split function
Thread Previous
|
Thread Next
From:
bulk 88 via RT
Date:
April 23, 2012 10:22
Subject:
[perl #9319] Perl bug -- split function
Message ID:
rt-3.6.HEAD-4610-1335201714-1578.9319-15-0@perl.org
On Mon Apr 23 08:12:05 2012, nicholas wrote:
> This is the underlying Win32 runtime realloc that has this wonderful
> "feature" of always copying? Or something layered on top of it?
>
> > Since 5.005_03, the tmps stack has been grown in chunks of 128 up to
512,
> > then in chunks of 512 after that.
>
> Given that the perl "malloc" for ithreads & fork emulation already ends
> up returning pointers "incompatible" with the system malloc thanks to the
> tracking header, would it be sensible to investigate defaulting Win32 to
> using perl's malloc.c? (With -DPERL_SBRK_VIA_MALLOC so that the win32
system
> malloc supplies the "raw" memory that malloc.c partitions)
>
> It seems crazy to have to keep putting in place work arounds for what is a
> solved problem.
>
> Nicholas Clark
>
> PS I looked to see whether it would be viable to replace the contiguous
> mortal stack into chunks. It seems that a little too much of the core
> assumes that it is a stack to make this easy. And dammit, why are we
> pandering to crap code? This is makework.
>
I suggest a percentage growth for the mortal stack realloc rather than
512 blocks, maybe /4 or >>2 (same thing). Or increase it to 4096 bytes
/32bit page size, which at that point will force a kernel call to the
paging system anyways. Is there a macro that is the local page size,
cross platform, already somewhere in Perl?
I made a couple examples of the windows alloc system. I compared Perl's
malloc, to Heap malloc, to C lib malloc. I ran each in its own process,
so they weren't competing for memory. The C lib is msvcr71.dll (vs
2003). -V is below.
I have an issue with Perl using the C lib's malloc system which is
layered over Win32's malloc (Heap*) system. Its wasteful indirection to
go through the c lib on windows. In the Dos Windows days the C lib
actually implemented its own memory allocator, see
http://msdn.microsoft.com/en-us/library/a6x53890%28v=vs.100%29.aspx but
its not used on NT Windows by default (do we make it the default on Win
Perl :-p? its still available in VS 2010) but without CRT SBH its
nothing but a wrapper for Heap*. I'm not sure if the CRT adds its own
header on top of Heap*. Above the SBH threshold, everything goes to Heap*.
Summary of my perl5 (revision 5 version 12 subversion 2) configuration:
Platform:
osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32
-D_CONSOL
E -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DU
SE_PERLIO',
optimize='-Od -MD -Zi -DDEBUGGING',
cppflags='-DWIN32'
ccversion='13.10.3077', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksi
ze=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug
-libpath:"c:\perl512\lib\
CORE" -machine:x86'
libpth="c:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib"
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32
.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib ws2_
32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
comctl32.lib msvcr
t.lib
perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comd
lg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib
ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
comctl32.lib m
svcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl512.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-libpath:"c:\p
erl512\lib\CORE" -machine:x86'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_TRACK_MEMPOOL PL_OP_SLAB_ALLOC
USE_ITHREADS USE_LARGE_FILES USE_PERLIO
USE_PERL_ATOF
Built under MSWin32
Compiled at Mar 23 2011 08:10:43
%ENV:
PERL_JSON_BACKEND="JSON::XS"
PERL_YAML_BACKEND="YAML"
@INC:
C:/perl512/site/lib
C:/perl512/lib
.
---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=9319
Thread Previous
|
Thread Next