Implementing a queue, memory

2002-10-31 Thread Thomas Drugeon
hello,

I am implementing a queue, using shift and push to put and remove elements
from an array.
The problem is that I don't know how Perl will manage the memory.
Do you have experiences on such arrays after a big number of shift/push?
Will Perl reallocate former used memory (relased from the shift) to next
elements (from the push)?
Don't you think it could lead to some memory leaks after some time?
Do you think using pop/unshift in stead of shift/push would make any
difference ?

Thank you in advance.
Thomas

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



Re: Implementing a queue, memory

2002-10-31 Thread Johan Lindstrom
At 14:39 2002-10-31 +0100, Thomas Drugeon wrote:

Will Perl reallocate former used memory (relased from the shift) to next
elements (from the push)?


IIRC perl is optimized for that scenario (I can't remember where I read it 
though). It shouldn't be a problem.


/J

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

Latest bookmark: Morbus Iff/Kevin Hemenway [October 31, 2002]
http://www.oreillynet.com/pub/au/779
dmoz (1 of 4): ...y/Ethnicity/Indigenous_People/Native_Americans/ 26


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


Re: Implementing a queue, memory

2002-10-31 Thread Thomas Drugeon
Thank you

Do you know any module implementig such queues in a file? like dmb tied
hashes do?

 IIRC perl is optimized for that scenario (I can't remember where I read it
 though). It shouldn't be a problem.


 /J


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



Re: Implementing a queue, memory

2002-10-31 Thread Thomas Drugeon
Sorry, I found it:

Tie::File


- Original Message -
From: Thomas Drugeon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 31, 2002 4:34 PM
Subject: Re: Implementing a queue, memory


 Thank you

 Do you know any module implementig such queues in a file? like dmb tied
 hashes do?

  IIRC perl is optimized for that scenario (I can't remember where I read
it
  though). It shouldn't be a problem.
 
 
  /J


 ___
 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: Implementing a queue, memory

2002-10-31 Thread Carl Jolley
On Thu, 31 Oct 2002, Thomas Drugeon wrote:

 Thank you

 Do you know any module implementig such queues in a file? like dmb tied
 hashes do?

  IIRC perl is optimized for that scenario (I can't remember where I read it
  though). It shouldn't be a problem.

Although I haven't tried it, _supposedly_ a file tied with
DB_File and specifying a $DB_RECNO type of data base will
support many of the array manipulation functions, e.g.

shift, unshift, pop, push including negative indices,
$h[-1] to get the last record or $h[-2] to get the
next to last record.

The reason why I stress the _supposedly_ is that trying
to use DB_File to read a $DB_HASH type file doesn't work
anymore.

 [EMAIL PROTECTED] Carl Jolley
 All opinions are my own and not necessarily those of my employer 

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