Re: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-31 Thread Yitzchak Scott-Thoennes
On Fri, Jul 29, 2005 at 07:21:44PM +0200, Krzysztof Duleba wrote: > Yitzchak Scott-Thoennes wrote: > > >However code like the above does end up using twice the space; it's > >allocated once to store the result of the x operation and again when > >it's copied to $a. > > Really? I hope you're wrong

Re: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-29 Thread Krzysztof Duleba
Igor Pechtchanski wrote: However code like the above does end up using twice the space; it's allocated once to store the result of the x operation and again when it's copied to $a. D'oh! I forgot that this was an assignment, not an initialization. I feel properly chastised. :-) How come th

Re: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-29 Thread Igor Pechtchanski
On Fri, 29 Jul 2005, Yitzchak Scott-Thoennes wrote: > On Wed, Jul 27, 2005 at 05:07:23PM -0700, Stephan Mueller wrote: > > "Igor Pechtchanski wrote: > > " > > " On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > > " > > > I've simplified the test case. It seems that Cygwin perl can't > > " > > > handl

Re: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-29 Thread Krzysztof Duleba
Yitzchak Scott-Thoennes wrote: However code like the above does end up using twice the space; it's allocated once to store the result of the x operation and again when it's copied to $a. Really? I hope you're wrong. Avoiding copy operation while declaring a new variable with a value is a very

Re: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-29 Thread Yitzchak Scott-Thoennes
On Wed, Jul 27, 2005 at 05:07:23PM -0700, Stephan Mueller wrote: > "Igor Pechtchanski wrote: > " > " On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > " > > > I've simplified the test case. It seems that Cygwin perl can't > " > > > handle too much memory. For instance: > " > > > > " > > > $ perl -e '$

Re: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-29 Thread Christopher Faylor
On Fri, Jul 29, 2005 at 11:45:05AM +0200, Gerrit P. Haase wrote: >Christopher Faylor wrote: > >>On Fri, Jul 29, 2005 at 12:16:42AM +0200, Gerrit P. Haase wrote: >> >>>Dave, >>> >>>Some comments on your analysis. >>> >>>The latest perl uses auto-image-base and the base address should be >>>differen

Re: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-29 Thread Igor Pechtchanski
On Fri, 29 Jul 2005, Gerrit P. Haase wrote: > At least we figured that perl crashes when it uses more than 384 MB RAM, > similar C programs don't crash. The fact that perl crashes is, IMO, a perl bug, which still needs to be fixed. Perl shouldn't *crash* (i.e., segfault). It could report an out

Re: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-29 Thread Gerrit P. Haase
Christopher Faylor wrote: On Fri, Jul 29, 2005 at 12:16:42AM +0200, Gerrit P. Haase wrote: Dave, Some comments on your analysis. The latest perl uses auto-image-base and the base address should be different than default. It fails anyway. Perl uses its own malloc, rebuilding with the syst

Re: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-28 Thread Christopher Faylor
On Fri, Jul 29, 2005 at 12:16:42AM +0200, Gerrit P. Haase wrote: >Dave, > >Some comments on your analysis. > >The latest perl uses auto-image-base and the base address should be >different than default. It fails anyway. > >Perl uses its own malloc, rebuilding with the system malloc shows >that it

Re: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-28 Thread Gerrit P. Haase
Dave, Some comments on your analysis. The latest perl uses auto-image-base and the base address should be different than default. It fails anyway. Perl uses its own malloc, rebuilding with the system malloc shows that it behaves similar than the C examples, I think the recent changes in Cygw

RE: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-28 Thread Igor Pechtchanski
On Thu, 28 Jul 2005, Dave Korn wrote: > Original Message > >From: Igor Pechtchanski > >Sent: 28 July 2005 14:58 > > > Hmm, but shouldn't this code fail regardless of the value of > > heap_chunk_in_mb? Why does increasing heap_chunk_in_mb make this > > succeed? > > Perhaps it only makes

RE: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-28 Thread Dave Korn
Original Message >From: Igor Pechtchanski >Sent: 28 July 2005 14:58 > Hmm, but shouldn't this code fail regardless of the value of > heap_chunk_in_mb? Why does increasing heap_chunk_in_mb make this succeed? Perhaps it only makes it succeed if you increase heap_chunk_in_mb until that

Re: Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-28 Thread Igor Pechtchanski
On Thu, 28 Jul 2005, Dave Korn wrote: > Original Message > >From: Krzysztof Duleba > >Sent: 28 July 2005 08:00 > > > Igor Pechtchanski wrote: > >> On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > >> > >>> I am not. I understand that this is how it should work > >>> theoretically, but I've _c

Bug identified [was RE: perl - segfault on "free unused scalar"]

2005-07-28 Thread Dave Korn
Original Message >From: Krzysztof Duleba >Sent: 28 July 2005 08:00 > Igor Pechtchanski wrote: >> On Thu, 28 Jul 2005, Krzysztof Duleba wrote: >> >>> I am not. I understand that this is how it should work theoretically, >>> but I've _checked_ that on a couple of Cygwin boxes with different

Re: perl - segfault on "free unused scalar"

2005-07-28 Thread Gerrit P. Haase
Gerrit P. Haase wrote: Gerrit P. Haase wrote: Krzysztof Duleba wrote: Igor Pechtchanski wrote: Actually, you're right. Perhaps it depends on what kind of malloc the program uses (i.e., whether it uses the Cygwin builtin malloc, or something else). That's strange. How could Perl use so

Re: perl - segfault on "free unused scalar"

2005-07-28 Thread Gerrit P. Haase
Gerrit P. Haase wrote: Krzysztof Duleba wrote: Igor Pechtchanski wrote: Actually, you're right. Perhaps it depends on what kind of malloc the program uses (i.e., whether it uses the Cygwin builtin malloc, or something else). That's strange. How could Perl use something essentially differ

Re: perl - segfault on "free unused scalar"

2005-07-28 Thread Gerrit P. Haase
Krzysztof Duleba wrote: Igor Pechtchanski wrote: Actually, you're right. Perhaps it depends on what kind of malloc the program uses (i.e., whether it uses the Cygwin builtin malloc, or something else). That's strange. How could Perl use something essentially different than malloc? I thought

Re: perl - segfault on "free unused scalar"

2005-07-28 Thread Krzysztof Duleba
Igor Pechtchanski wrote: On Thu, 28 Jul 2005, Krzysztof Duleba wrote: I am not. I understand that this is how it should work theoretically, but I've _checked_ that on a couple of Cygwin boxes with different versions of cygwin1.dll and gcc. All of them didn't really care that heap_chunk_in_mb wa

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Igor Pechtchanski
On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > Igor Pechtchanski wrote: > > > > After setting heap_chunk_in_mb to 2048, all those tests passed. > > > Thanks! But I still don't understand why C isn't bound by > > > heap_chunk_in_mb and perl is. > > > > I think you're confused. All Cygwin programs,

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Krzysztof Duleba
Igor Pechtchanski wrote: After setting heap_chunk_in_mb to 2048, all those tests passed. Thanks! But I still don't understand why C isn't bound by heap_chunk_in_mb and perl is. I think you're confused. All Cygwin programs, including those written in C, are bound by heap_chunk_in_mb. Unless y

RE: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Stephan Mueller
Igor Pechtchanski wrote: " On Wed, 27 Jul 2005, Stephan Mueller wrote: " > Igor Pechtchanski wrote: " > " > " (I wrote:) " > " > End result is that the perl internal representation in the example " > " > above probably only needs about 200MB of space, and not double that, " > " > as suggested. " >

RE: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Igor Pechtchanski
On Wed, 27 Jul 2005, Stephan Mueller wrote: > Igor Pechtchanski wrote: > > " (I wrote:) > " > End result is that the perl internal representation in the example > " > above probably only needs about 200MB of space, and not double that, > " > as suggested. > " > " Umm, that was unclear from the des

RE: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Stephan Mueller
Igor Pechtchanski wrote: " (I wrote:) " > End result is that the perl internal representation in the example above " > probably only needs about 200MB of space, and not double that, as " > suggested. " " Umm, that was unclear from the description on the perlunicode manpage. " That, combined with P

RE: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Igor Pechtchanski
On Wed, 27 Jul 2005, Stephan Mueller wrote: > "Igor Pechtchanski wrote: > " > " On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > " > > > I've simplified the test case. It seems that Cygwin perl can't > " > > > handle too much memory. For instance: > " > > > > " > > > $ perl -e '$a="a"x(200 * 1024 *

RE: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Stephan Mueller
"Igor Pechtchanski wrote: " " On Thu, 28 Jul 2005, Krzysztof Duleba wrote: " > > > I've simplified the test case. It seems that Cygwin perl can't " > > > handle too much memory. For instance: " > > > " > > > $ perl -e '$a="a"x(200 * 1024 * 1024); sleep 9' " > > > " > > > OK, this could have failed

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Christopher Faylor
On Thu, Jul 28, 2005 at 12:35:02AM +0200, Krzysztof Duleba wrote: >Igor Pechtchanski wrote: >>On Wed, 27 Jul 2005, Krzysztof Duleba wrote: > >>>I've simplified the test case. It seems that Cygwin perl can't handle >>>too much memory. For instance: >>> >>>$ perl -e '$a="a"x(200 * 1024 * 1024); sleep

Re: heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Krzysztof Duleba
Igor Pechtchanski wrote: $ cat foo.c #include int main(int argc, char * argv[]){ int i; char * ptrs[1024]; for(i = 0; i < atoi(argv[2]); ++i){ ptrs[i] = malloc(1024 * 1024 * atoi(argv[1])); memset(ptrs[i], 'a', 1024 * 1024 * atoi(argv[1]));

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Igor Pechtchanski
On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > Igor Pechtchanski wrote: > > On Wed, 27 Jul 2005, Krzysztof Duleba wrote: > > > > I've simplified the test case. It seems that Cygwin perl can't handle > > > too much memory. For instance: > > > > > > $ perl -e '$a="a"x(200 * 1024 * 1024); sleep 9' >

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Krzysztof Duleba
Igor Pechtchanski wrote: On Wed, 27 Jul 2005, Krzysztof Duleba wrote: I've simplified the test case. It seems that Cygwin perl can't handle too much memory. For instance: $ perl -e '$a="a"x(200 * 1024 * 1024); sleep 9' $ perl -e '$a="a"x(1024 * 1024);my %b; $b{$_}=$a for(1..400);sleep 9'

heap_chunk_in_mb default value (Was Re: perl - segfault on "free unused scalar")

2005-07-27 Thread Igor Pechtchanski
On Thu, 28 Jul 2005, Krzysztof Duleba wrote: > Igor Pechtchanski wrote: > > > > > > > $ ./inter.pl > > > > > > perl> sub foo($){$a=shift;foo($a+1);} > > > > You do realize you have infinite recursion here, right? > > Sure. > > > > > > Segmentation fault (core dumped) > > And this is Windows saying

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Krzysztof Duleba
Igor Pechtchanski wrote: $ ./inter.pl perl> sub foo($){$a=shift;foo($a+1);} You do realize you have infinite recursion here, right? Sure. Segmentation fault (core dumped) And this is Windows saying "I don't think so". :-) :-) I don't know. Maybe it is a Windows feature that applicati

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Gerrit P. Haase
Krzysztof Duleba wrote: But there's plenty of memory left when perl crashes. I have 1 GB RAM and 1 GB swap file. I've simplified the test case. It seems that Cygwin perl can't handle too much memory. For instance: $ perl -e '$a="a"x(200 * 1024 * 1024); sleep 9' This requires about 525 MB

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Igor Pechtchanski
On Wed, 27 Jul 2005, Krzysztof Duleba wrote: > Gerrit P. Haase wrote: > > > > > $ ./inter.pl > > > > perl> sub foo($){$a=shift;foo($a+1);} You do realize you have infinite recursion here, right? So you're most likely running out of stack (which Perl may be re-allocating on the heap). > > > > pe

RE: perl - segfault on "free unused scalar"

2005-07-27 Thread Dave Korn
Original Message >From: Krzysztof Duleba >Sent: 27 July 2005 17:56 > Then why does the following code fail? To find out, run /bin/perl.8.6.exe under gdb/insight and breakpoint sbrk. You'll see that VirtualAlloc is failing. By reassigning $eip to GetLastError immediately after one of t

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Krzysztof Duleba
Gerrit P. Haase wrote: $ ./inter.pl perl> sub foo($){$a=shift;foo($a+1);} perl> foo 1 Out of memory during request for 4040 bytes, total sbrk() is 402624512 bytes! Segmentation fault (core dumped) Another version (with "my $a"): perl> sub foo($){my $a=shift;foo($a+1);} perl> foo 1 Out of me

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Gerrit P. Haase
Krzysztof Duleba wrote: Gerrit P. Haase wrote: With 5.8.7 I get the core dump after calling `foo 1` the first time: $ ./inter.pl perl> sub foo($){$a=shift;foo($a+1);} perl> foo 1 Out of memory during request for 4040 bytes, total sbrk() is 402624512 bytes! Segmentation fault (core dumped)

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Krzysztof Duleba
Gerrit P. Haase wrote: $ ./inter.pl perl> sub foo($){$a=shift;foo($a+1);} perl> foo 1 Out of memory during "large" request for 134221824 bytes, total sbrk() is 273211392 bytes at (eval 18) line 1. perl> foo 1 Out of memory during request for 67289644 bytes, total sbrk() is 394086400 bytes !

Re: perl - segfault on "free unused scalar"

2005-07-27 Thread Gerrit P. Haase
Krzysztof Duleba wrote: While playing with perl in interactive mode, I experienced strange memory error in Cygwin perl. Trying the same scenario on Linux boxes results in perl being killed after using all memory (tested on machines with 128 - 2048 MB RAM), but on Cygwin perl dies in a differen

perl - segfault on "free unused scalar"

2005-07-27 Thread Krzysztof Duleba
While playing with perl in interactive mode, I experienced strange memory error in Cygwin perl. Trying the same scenario on Linux boxes results in perl being killed after using all memory (tested on machines with 128 - 2048 MB RAM), but on Cygwin perl dies in a different way. The following scr