Hash growth memory allocation: can it be tweaked?

2002-05-13 Thread Michael S. Muegel

Hi. I'm using ActiveState build 631 on Win2K. Not self compiled, just the
binary download from activestate.com.

I have noticed that the way memory is allocated when hashes are
created/grown varies considerably under Linux and my Win2K install. In Linux
the memory usage steps up very gradually as the hash is updated (inserts,
updates). But on Win2K it makes huge jumps. It seems to start with adding
8M, then 32M (8x4), then 128M (32x4), and so on (I would guess).

For example, in the enclosed test script the memory footprint will run
approximately like so:

   Iterations Memory
   -- --
   0 .. 6,100 6 M
   6,200 .. 25,00014M (6 + 8)
   26,000 .. 100,000  46M (14 + 32)
   110,000 .. ?   174 (46 + 128)

Now before anybody gets on me about using a more appropriate out-of-memory
database, I am for a bunch of stuff but I have a need to do a part using a
hash and it is possible I might hit the 32M boundary. And this would run on
a user's desktop and I'd hate to grab 32M extra when I only may need 512K
extra.

Nothing special about my test script. I'm sure this is a FAQ but I could not
find any hits to many searches.

My question is can this pre-allocation amount (or whatever it is) be tuned?
Can anyone explain the reason this works this way?

Thanks,
-Mike

# Usage: simple-hash-test count

use strict;

my($Count) = shift || die bad usage\n;

my($I, %Hash);
my($Key) = a;

for ($I = 1; $I = $Count; ++$I)
{
   # Silly sample data struct
   ++$Key;
   push(@{$Hash{imported}-{open}}, $I);
   push(@{$Hash{imported}-{closed}}, $I);
   $Hash{exported}-{open}-{$Key} = [ $I ];
   $Hash{exported}-{closed}-{$Key} = [ $I ];
}
--
Michael S. Muegel
Dallas, Texas

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Re[2]: Beating the fork() horse to death...

2002-05-13 Thread John Serink

That is handy to know. Thanx for the info.

Cheers,
John

 -Original Message-
 From: Eugeniy Ogloblin [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 13, 2002 2:41 PM
 To: [EMAIL PROTECTED]
 Subject: Re[2]: Beating the fork() horse to death...
 
 
 Hello John,
 
 Monday, May 13, 2002, 9:25:15 AM, you wrote:
 
 JS You have to remember that at the time of the fork a 
 snapshot is taken of the
 JS parent process's variables and memory and reproduced for 
 the child. If you
 JS want the parent to know the results of whatever you do in 
 the child, you
 JS have three options:
 JS 1. Write the results from the child to a file and have 
 the parent read it,
 JS 2. Open a pipe between the child and the parent and pipe 
 the results back to
 JS the parent,
 JS 3. Open a socket for child/parent communications.
  
 JS Since the fork produces another process, all memory is 
 separate as the
 JS processes are two totally different entities which is why 
 you require one of
 JS the above techniques for inter process communications.
 
 it's not a strong rule
 
 
 For instance, exists one tricky way for the interaction 
 between parent and child processes in ActiveState Perl.
 If you create Win32::GUI object before calling fork , it will 
 be global for all processes.
 And you will be able to ensure interprocess interaction with its help.
 
 use Win32::GUI;
 $|++;
 
 $w=new Win32::GUI::Window(
   -name = win,
   -text = 1,
 );
 $t=$w-AddTimer(timer1,1500);
 
 my $pid=fork;
 if($pid){
my $pid2=fork;
if($pid2){
Win32::GUI::Dialog();
}
else{
  while(1){
  $w-Text($w-Text+1);#this child process set global variable
  sleep 2;
  }
}
 }
 else{
while(1){
print $w-Text.\n; #another child process print global
variable value
sleep 1;
}
 }
 
 
 
 -- 
 Best regards,
  Eugeniymailto:[EMAIL PROTECTED]
 
 
 ___
 Perl-Win32-Users mailing list
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Preferred PERL Editor

2002-05-13 Thread Denis Pleic

Hi folks,

For those looking for something powerful (emacs-style), but are 
intimidated by sheer size of (X)Emacs on either Windows or Linux, 
I wholehartedly recommend Jasspa MicroEmacs (www.jasspa.com).

It's GPLed, works on both platforms, and is rather small (can be 
squeezed to under 1MB for those tight on HD space).

As a matter of fact, you can take a look at the headers of this 
mail to see that I'm also using it as my e-mail editor :-)

BTW, it has Perl (and other) highlighting, and is thoroughly 
configurable (keystokes, general appearance, etc.).

Naturally, I'm using it as my Perl editor of choice on Windows :-)

It's definitely worth checking out if you're still looking for 
that *perfect* editor :-)

Regards,

Denis

-
-- Croatian Translation  Language Services  -- * dpleicATopen.hr
+
Denis Pleic  | Phone: (+385) 42 305 751 
M. Vrhovca 6 | Fax: (+385) 42 305 752
HR-42000 Varazdin| Mobile: (+385) 98 798 323
 CROATIA | http://www.open.hr/~dpleic/indx-e.html

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re:Delete a line and replace

2002-05-13 Thread Jorge Goncalvez



Hi, i have this file /etc/passwd like this:


Everyone:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Administrator:unused_by_nt/2000/xp:500:513:U-LININF54\Administrator,S-1-5-21-175
7981266-2139871995-725345543-500:/home/Administrator:/bin/bash
anonymous:unused_by_nt/2000/xp:1017:513:U-LININF54\anonymous,S-1-5-21-1757981266
-2139871995-725345543-1017:/home/anonymous:/bin/bash
ftp:unused_by_nt/2000/xp:1018:513:U-LININF54\ftp,S-1-5-21-1757981266-2139871995-
725345543-1018:/:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:U-LININF54\Guest,S-1-5-21-1757981266-21398719
95-725345543-501:/home/Guest:/bin/bash
HelpAssistant:unused_by_nt/2000/xp:1000:513:Remote Desktop Help Assistant 
Account,U-LININF54\HelpAssistant,S-1-5-21-1757981266-2139871995-725345543-1000:/
home/HelpAssistant:/bin/bash


I wanted to delete all the line which begins with ftp and then replace Guest by 
ftp in all file.

Thanks. 




___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Doubt in DB_File module

2002-05-13 Thread Sundara Rajan

Ponnam
The file you are trying to create already exists as a text file and so
cannot be created as a DB - which is why it fails. Open the team.txt first
and pass the value into a hash/array/variables first and then push values
into the  db. the db should be called something else. 
se warnings ;
use strict ;
use DB_File ;
use Fcntl ;
our ($dotdir, $HISTORY, %hist_db,$user, $team) ;
# you'll get the values below from a text file into anything here i've
shown a hash
my %hist = (abnsb =asghghas, asggsag= sshghs);
$dotdir = c:\\whatever;
$HISTORY = $dotdir\\team.dbm;
tie %hist_db, 'DB_File', $HISTORY
or die Cannot open $HISTORY: $!\n ;;
foreach $user (keys %hist) {

$hist_db{$user}=$hist{$user};
}
# Dump the complete database
while ( ($user, $team) = each %hist_db ) {
print $user, $team\n ;
}
untie %hist_db ;


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 5:01 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Doubt in DB_File module


Dear friends,
When i  am trying to process the flat database using the DB_File
, it is giving the error like this ,
  Cannot open C:\CC-LIC-USAGE\teams.txt: File exists

How will i get the values from the existing file. Is it possible
or not.
Expecting your valuable suggestions. Please ...


CODE

Contents in the teams.txt file

pons  TEAM1
ram   team2

 use warnings ;
use strict ;
use DB_File ;
use Fcntl ;
our ($dotdir, $HISTORY, %hist_db, $user, $team) ;
$dotdir = C:\\CC-LIC-USAGE;
$HISTORY = $dotdir\\teams.txt;
tie %hist_db, 'DB_File', $HISTORY
or die Cannot open $HISTORY: $!\n ;;
# Dump the complete database
while ( ($user, $team) = each %hist_db ) {
print $user, $team\n ;
}
untie %hist_db ;



Expecting  your wishes,
Pons.

Ponnambalam. M.A.
Philips Medical Systems,
Philips Innovation Campus,
#1,Murphy Road, Ulsoor.
Bangalore - 560008. INDIA
Phone : +91- 080 - 557 9000 Extn: 1013
E-mail: [EMAIL PROTECTED]


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Re: Preferred PERL Editor

2002-05-13 Thread Sundara Rajan

The site URL is/was right but it seems to have got hacked or something ...i
know this seems odder but try http://www.lost-sunglasses.de/ I just tried
it and it seems to work

-Original Message-
From: Abner, Daniel [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 11:58 PM
To: 'Mark Bergeron'; [EMAIL PROTECTED]
Subject: RE: Re: Preferred PERL Editor


Mark -

The link you sent for open-perl-ide is not a perl site at all.  It redirects
you to a ridiculous site that has pop up window after pop up window.  The
content didn't appear to have anything to do with programming at all...

Did you miss type the url?

Dan.


-Original Message-
From: Mark Bergeron [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: Re: Preferred PERL Editor


I haven't ever used TextPad. But, I have used and are using; Crimson Edit
(syntax highlighting, block and bracket matching and you can tie Perl right
into it. it's free), NoteTab Light (fast, nicely customizable, not a lot of
advanced features for the free one but hey! free). Then there is Open Perl
IDE http://open-perl-ide.sorceforge.net. Win32 only I believe. Write code,
debug code, etc... (also free). Between these I can get just about anything
done. I've also used MultiEdit but that's gonna cost you 100 bucks or so.
Not bad though.

My 2 cents,
Mark Bergeron

-Original Message-
From: Lee Goddard[EMAIL PROTECTED]
To: John Deighan[EMAIL PROTECTED],
[EMAIL PROTECTED]
Date: Fri May 10 01:48:24 PDT 2002
Subject: Re: Preferred PERL Editor

At 13:01 09/05/2002 -0500, John Deighan wrote:
I would vote for TextPad. However, I have a different twist on this 
question. Is there an editor, with similar features as TextPad and 
UltraEdit, that runs both on Windows and on Linux? That would be most 
useful to me. I guess XEmacs may be one, but I've never used it.

Textpad have been promising such a version for over a year now :-(

Lee Goddard
perl -e while(1){print rand0.5 ? chr 47 : chr 92}

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
GO.com Mail
Get Your Free, Private E-mail at http://mail.go.com


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Reverse Engineering

2002-05-13 Thread Tillman, James

I seem to remember from using an older version of PerlApp that it actually
extracted the perl source into temporary files when it ran.  If this is
still true, it might be possible to locate the temporary files...

I have to admit, this is a shot in the dark for me, because that was a
looong time ago.

jpt

 -Original Message-
 From: Batchelor, Gareth [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 13, 2002 7:07 AM
 To: '[EMAIL PROTECTED]'
 Subject: Reverse Engineering
 
 
 Hi,
 
 I recently used PerlApp to create a Win32 executable from a 
 perl script that
 I wrote. Unfortunately I have just lost the source code, and 
 I would like to
 find out if there is any way for me to obtain the code from 
 the executable.
 Does anyone know if this can be done?
 
 TIA
 Gareth
 
 
 **
 **
  This message contains information that may be privileged or 
 confidential and 
 is the property of the Cap Gemini Ernst  Young Group. It is 
 intended only for 
 the person to whom it is addressed. If you are not the 
 intended recipient, you 
 are not authorized to read, print, retain, copy, disseminate, 
 distribute, or use 
 this message or any part thereof. If you receive this message 
 in error, please 
 notify the sender immediately and delete all copies of this message .
 **
 **
 ___
 Perl-Win32-Users mailing list
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Reverse Engineering

2002-05-13 Thread Johan Lindstrom

At 12:06 2002-05-13 +0100, Batchelor, Gareth wrote:
I recently used PerlApp to create a Win32 executable from a perl script that
I wrote. Unfortunately I have just lost the source code, and I would like to
find out if there is any way for me to obtain the code from the executable.
Does anyone know if this can be done?

This was discussed at PerlMonks:
http://www.perlmonks.org/index.pl?node_id=96925
http://www.perlmonks.org/index.pl?node_id=97005

Note that this relates to PDK 3, and if you use the latest version of 
PerlApp it may not apply.

I don't think the source is extracted to disk, only the DLLs (they are also 
left behind in a temp directory after the program is done which is kind of 
sloppy (this goes for PDK 3)).


/J

 --  --- -- --  --  -- -  - -
Johan LindströmSourcerer @ Boss Casinos [EMAIL PROTECTED]

Latest bookmark: Downright useful downloads
http://www.answersthatwork.com/downright.htm
dmoz (1 of 10): /Arts/Music/Reviews/Independent_or_Alternative


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: Why my boss doesn't want Perl...

2002-05-13 Thread roger . day

aren't all viruses written in VB?

Then again, use perl: move away from the M$ monoculture.

At 10/05/2002 13:58:02, Tillman, James [EMAIL PROTECTED] wrote:
#   Biggest problem I can find with Perl is that it is free, and
#   relatively easy.
#
#  Agreed!
#
#   I suppose there are a lot of hackers who give Perl Hackers a
#   bad name, but isn't that the case with VB and C++?
#
#  Certainly, but I'll wager there are very, very, very few VB-only programmers
#  who deserve the label of hacker  ;-)
#
#  jpt
#  ___
#  Perl-Win32-Users mailing list
#  [EMAIL PROTECTED]
#  To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
#
Roger


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs