0 Replies Latest reply on Jun 26, 2014 2:50 PM by a847aad4-7ec6-481a-b4cd-c4b0c6c2688a

    ORA-28579: network error during callback from external procedure agent....(some heap issue)


      Snippet: A simple external C dll to which some numbers(107) are passed from PLSQL.

      Issue: When this external C function is called from PLSQL the number are received by the C function in the array(on stack). HOWEVER, if I un-comment the commented lines for a dynamic array instead of a static the call fails with the captioned message.

      Please suggest


      #define ARRSIZE 107

      extern "C" __declspec(dllexport)  int ooci_ntm(OCIExtProcContext *context, OCITable* clients)


      OCIEnv *envhp;

      OCISvcCtx* svch;

      OCIError *errhp;

      double onumm[ARRSIZE]; //Works if its a static array on stack

      //double* onumm= (double*)malloc(sizeof(double) * ARRSIZE);  //However, if instead of the above array if the memory is allocated dynamically on heap then

      sword status;

      boolean exist;

      uword nelems;

      OCIExtProcGetEnv (context, &envhp, &svch, &errhp);

      OCINumber **client_elem = (OCINumber**)malloc(sizeof(OCINumber*) * ARRSIZE);

      status = OCICollGetElemArray(envhp, errhp, clients, index, &exist,  (void**)client_elem, (dvoid **)0, &nelems);

      status = OCINumberToRealArray(errhp,(const OCINumber**)client_elem,nelems,sizeof(double),(void*)onumm);



      return size;