Jump to content

unlimited queue size


Recommended Posts

Hello all,

if I see an unlimited queue size, I think LV must realloc the memory every operation with this queue. Now I ask me, its only if the size is unlimited or the memory will be reallocate if the size is definied?

If the memory will be reallocate, its more more slower as the "normally" queue in other programming languages.

Eugen

Link to comment

CITATION(Eugen Graf @ Mar 29 2007, 09:27 PM)

Hello all,

if I see an unlimited queue size, I think LV must realloc the memory every operation with this queue. Now I ask me, its only if the size is unlimited or the memory will be reallocate if the size is definied?

If the memory will be reallocate, its more more slower as the "normally" queue in other programming languages.

Eugen

Good question... If I was at work I would test it on different computers to see if the Q size is actually unlimited !

I am interested in the answer and the reasons... :book:

Link to comment

As I understand it, queues will dynamically allocate memory, but free memory only when destroyed. The online help states:

Note max queue size only limits the number of elements in the queue. It does not preallocate memory. Enqueue the maximum number of elements and flush the queue to preallocate the queue. The queue reserves more memory as its size increases and releases that memory only when you destroy the queue.
I almost always create my queues as part of my application startup using a fixed size, immediately populate them with dummy data (to reserve the memory) and then flush the queue.

I think allowing a queue grow to unbounded is "asking for trouble".

Link to comment

QUOTE(LV Punk @ Mar 30 2007, 01:50 PM)

Thank you very much for this information.

QUOTE(LV Punk @ Mar 30 2007, 01:50 PM)

I almost always create my queues as part of my application startup using a fixed size, immediately populate them with dummy data (to reserve the memory) and then flush the queue.

Do you do it in a for loop? So in your initialisation step? Can you post an exapmple? Thanks

QUOTE(LV Punk @ Mar 30 2007, 01:50 PM)

I think allowing a queue grow to unbounded is "asking for trouble".

Its right.

Eugen

Link to comment

QUOTE(LV Punk @ Mar 30 2007, 06:50 AM)

I think allowing a queue grow to unbounded is "asking for trouble".

It could be a problem, but it's absolutely amazing how often it works just fine. CPUs are fast enough compared with various bus speeds that the dequeue loops for most apps I've seen -- particularly for data aquisition stuff -- are way faster than the enqueue loops, so the queues stay small.

Link to comment
  • 4 weeks later...

QUOTE(LV Punk @ Mar 30 2007, 07:55 PM)

Thanks, but it's only for "string" queues. If I have a queue of other datatype I have to adapt your BD to my type. Are there any possibility to adapt the data type(e.g. by variant), I can use this VI for every queue?

Eugen

Link to comment

QUOTE(LV Punk @ Mar 30 2007, 01:55 PM)

It is far from being evident that LabVIEW keeps the strings data in the queue. While it can keep as many as string handles as the queue size, I doubt it keeps the data itself in the queue but just place holders for handles. I would think it is the same for variable length data like arrays and variants. On dequeuing, does LabVIEW copy the string to the caller (keeping an copy internal to the queue) or just pass the string handle?

Link to comment

QUOTE(jpdrolet @ Apr 25 2007, 03:14 PM)

It is far from being evident that LabVIEW keeps the strings data in the queue. While it can keep as many as string handles as the queue size, I doubt it keeps the data itself in the queue but just place holders for handles. I would think it is the same for variable length data like arrays and variants. On dequeuing, does LabVIEW copy the string to the caller (keeping an copy internal to the queue) or just pass the string handle?

Allthough I don not know it, I'd bet that enqueuing / dequeuing is a *call by reference* operation. I can't see any sense for duplicating the data, just for the purpose to hand them over to an other function without any modification. And I can not imagine how to implement polymorphic behaviour on a primitive without pointer operations ...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.