Skip to content

Possible memory leak when dequeuing less messages than buffer size #198

@bernardo-silva

Description

@bernardo-silva

This is a follow up of the issue godror/godror#382.
Me and another user have noticed a memory leak when dequeuing more than one message at a time.
The cause seems to be related to allocating more messages than the ones that are then actually dequeued.
I'll place here the relevant comment from Godror's maintainer:

Strange. If I interpret this correctly, then it means that iff we deque with the proper size (as many as there's waiting), then there' no leak. Otherwise, it leaks.
dpiDeq__deq in odpi/src/dpiQueue.c buffers payload, indicator, message id arrays.
But I see a possible glitch: it allocates and initializes the given number of dpiMsgProps,
but never frees extras if less than the given number of messages have been dequed.
This should not be a problem, as this allocates only once, and reuses the allocated dpiMsgProps.

Could you please have a look into this?
Thank you!

  1. What version of ODPI-C are you using (see dpi.h)? v5.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions