-996 adl_memGet() memory allocation failure

Hi everyone,

            I m using flash memory for storing the data, reading back to send the data through HTTP protocol.

But my code works fine in wavecom Q2687H and when i used the same code in Q2686G it is showing the following error.Can anyone reply what is the problem. Thanks.


Looks like the WIP library is running out of memory (RAM) somewhere.

Have you set up your stack variables appropriately?
Are you closing unused/completed connections correctly?
Does this happen the first time you try to connect, or after some time?

ciao, Dave

The ‘G’ and ‘H’ suffixes indicate different memory sizes - don’t they…?


But the ‘G’ is supposed to have more RAM than the ‘H’…

ciao, Dave

Thanks for all ur reply

I know Q2686 G has more RAM memory than Q2687 H but why this problem occurs with memory allocation failure.

Do both devices have the same Firmware revision?

As davidc asked, does this occur immediately, or after some time?

Have you tried putting in some adl_memGetInfo calls to check the status of the ADL Memory Service as your app runs :question:

This problem occurs after some 2 seconds after the reading of data from flash memory.


Yes both the devices have the same Firmware version 6.30 and Firmware package R74.

Yes but it returns OK


This sounds like the TCP error is a result of the FLASH read.

  • How much data are you reading from the flash and then trying to upload via HTTP?
  • Are you releasing buffers after reading from FLASH? Some of the openAT API’s allocate their own memory area when you call the function (i.e. adl_messageSend() does this) and you have to manually release any memory that you allocated prior to the function call.
  • And are you reading from FLASH or the APPLICATION & DATA area?

ciao, Dave

Your first error is:

Do you handle that error, when opening HTTP client?
But, under proper design you should never get that error at all. Check AT+WIPS settings.

Check davidc’s suggestions:

Im using only the flash area for storage and reading of data.

Im reading 250 bytes of data from the flash memory and sending them all.

Im overwriting the buffer each time i read form the flash memory, because i allocated that buffer with
fixed size
ie) Rec_buffer[250];

yes Im completely closing the connection immediately after the HTTP sessions.

Were you able to fix this problem? It seems I have a problem which looks like yours.
After a while communicating between a server I get this WIP_CEV_ERROR -996.
I always close my connections, but after a while if I try to open a created channel I get this error.
I hope you can help :slight_smile:

do you also have the error, that no more free sockets are avaiable?
if so, wait for the http finalizer to be called (you can specify the method in the creation of your DataChannel) before you create any new calls.
Or, if you have alot of connections, make a counter which checks how many connections you are currently using and check its value before you create a new one.

Thanks for the fast response. It seems I have no other errors than the -996. My connection is finalized, but still I get this error while I think I have more than enough RAM available. Can it have something to do with the send or receive buffers? I don’t send large amounts of data, just small amounts. The error seems to be triggered after a few connections.

http_ClientCtx.HttpDataCh = wip_getFileOpts(
	WIP_COPT_HTTP_HEADER, "Accept", "text/html",
	WIP_COPT_HTTP_HEADER, "From", "Test@test.com",
	WIP_COPT_HTTP_HEADER, "Content-Type", "application/x-www-form-urlencoded",
	WIP_COPT_FINALIZER, CheckFinalizer,
if (http_ClientCtx.HttpDataCh == NULL){
	TRACE((3, "Cannot create http data channel" ));
	wip_close( http_ClientCtx.HttpCnxCh);
	ret =-1;
	TRACE((3, "Created HTTP data channel" ));

static void CheckFinalizer( void *ctx ) {
	TRACE((3, "HttpDataHandler: Channel finalized"));

Within HttpDataHandler:

	// error
	TRACE((3, "HttpDataHandler: WIP_CEV_ERROR %d\n",
	adl_atSendResponse ( ADL_AT_UNS, "HttpDataHandler: ERROR\r\n" );
	wip_close( ev->channel);
	CloseFB = wip_close( ev->channel);// data channel close
	if(CloseFB == 0){
		TRACE((3,"Cev Closed"));
		TRACE((3,"Close Error, %d", CloseFB));

This is my TRACE feedback:

2012/07/05;11:13:08:583;001;ADL;3;Cev Closed
2012/07/05;11:13:08:590;001;ADL;3;HttpDataHandler: Channel finalized

2012/07/05;11:13:21:623;001;ADL;3;Created HTTP data channel
2012/07/05;11:13:21:728;001;ADL;3;HttpDataHandler: WIP_CEV_ERROR -996<LF>
2012/07/05;11:13:21:732;001;ADL;3;HttpDataHandler: Channel finalized

Is there anyone who knows something about my previous questions and can the problem have something to do with the send or receive buffers?