Menu

#20 vos_memInit() does not handle provided memory pool

1.2.0.0
closed
1160 (1)
2014-02-12
2014-02-11
No

vos_memInit() does not currently work when provided a pointer to a memory area via the pMemoryArea parameter. The reason for this is that it only does parameter checks for two out of three possible conditions: 1) use standard malloc calls and 2) allocate from the heap once. These two conditions are currently handled by the following parameter checks in the code:

if (pMemoryArea == NULL && size == 0) / This means we will use standard malloc calls /
{
...
}

and

if (pMemoryArea == NULL && size != 0) / We must allocate memory from the heap once /
{
...
}

The following code needs to be added to handled the third condition of a provided memory area:

if (pMemoryArea != NULL && size != 0) / Use the provided memory area /
{
gMem.pArea = pMemoryArea;
}

Discussion

  • Armin-Hagen Weiss

    • labels: --> 1160
    • status: open --> closed
    • assigned_to: Armin-Hagen Weiss
     
  • Armin-Hagen Weiss

    Additionally the forth possibility returns VOS_PARAM_ERR.

     

Log in to post a comment.

MongoDB Logo MongoDB