Skip to content

Commit 3f4967e

Browse files
committed
Lower memory
1 parent 5ab1841 commit 3f4967e

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

framework/include/vx_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class Context : public Reference
272272
EventQueue event_queue;
273273
#endif
274274
/*! \brief The graph queue for the context */
275-
vx_value_set_t graph_queue[VX_INT_MAX_QUEUE_DEPTH];
275+
vx_value_set_t graph_queue[VX_INT_MAX_LOOP];
276276
/*! \brief The number of graphs in the queue */
277277
vx_size numGraphsQueued;
278278
};

framework/include/vx_internal.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@
176176
/*! \brief Maximum queue depth.
177177
* \ingroup group_int_defines
178178
*/
179-
#define VX_INT_MAX_QUEUE_DEPTH (100002)
179+
#define VX_INT_MAX_QUEUE_DEPTH (32)
180+
181+
/*! \brief The maximum number of loops.
182+
* \ingroup group_int_defines
183+
*/
184+
#define VX_INT_MAX_LOOP (100002)
180185

181186
/*! \brief The value to use in event waiting which never returns.
182187
* \ingroup group_int_defines
@@ -397,7 +402,7 @@ typedef struct vx_value_set_t {
397402
* \ingroup group_int_osal
398403
*/
399404
typedef struct vx_queue_t {
400-
vx_value_set_t *data[VX_INT_MAX_QUEUE_DEPTH];
405+
vx_value_set_t *data[VX_INT_MAX_LOOP];
401406
vx_int32 start_index;
402407
vx_int32 end_index;
403408
vx_sem_t lock;

framework/src/vx_osal.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ vx_bool Osal::readQueue(vx_queue_t *q, vx_value_set_t **data)
616616
{
617617
*data = q->data[q->start_index];
618618
q->data[q->start_index] = nullptr;
619-
q->start_index = (q->start_index + 1)%VX_INT_MAX_QUEUE_DEPTH;
619+
q->start_index = (q->start_index + 1) % VX_INT_MAX_LOOP;
620620
red = vx_true_e;
621621
if (q->start_index == q->end_index) // wrapped to empty
622622
{
@@ -658,7 +658,7 @@ vx_bool Osal::writeQueue(vx_queue_t *q, vx_value_set_t *data)
658658
if (q->end_index == -1) // empty
659659
q->end_index = q->start_index;
660660
q->data[q->end_index] = data;
661-
q->end_index = (q->end_index + 1)%VX_INT_MAX_QUEUE_DEPTH;
661+
q->end_index = (q->end_index + 1) % VX_INT_MAX_LOOP;
662662
wrote = vx_true_e;
663663
// cause other writers to unblock.
664664
if (q->start_index != q->end_index)
@@ -721,7 +721,7 @@ void Osal::printQueue(vx_queue_t *q)
721721
{
722722
vx_uint32 i;
723723
VX_PRINT(VX_ZONE_OSAL, "Queue: %p, lock=%p s,e=[%d,%d] popped=%s\n",q, &q->lock, q->start_index, q->end_index, (q->popped?"yes":"no"));
724-
for (i = 0; i < VX_INT_MAX_QUEUE_DEPTH; i++)
724+
for (i = 0; i < VX_INT_MAX_LOOP; i++)
725725
{
726726
if (q->data[i])
727727
{

0 commit comments

Comments
 (0)