Memory Leakage When Reconnection is performed?

Hi, I’m doing a basic GPS Tracking using Wavecom Modem Fastrack Supreme 10, firmware 6.63g

Initial steps includes creating GPRSBearer, then IPBearer, finally TCP Connection.

Due to the sensitive nature of this tracking application, we are currently polling for GPRS state every second. When GPRS exists, the information is sent through the Channel, when it’s not we store it in flash.

The tricky part is the reconnection from Non-GPRS area to GPRS area. We currently use the wip_close(Channel) when GPRS does not exist, and once we detect that GPRS exists, we do another wip_tcpClientCreate.

Give or take, in one day, this might happen more 20-30 times. Will this cause a memory leakage and subsequently later on cause it to not create a TCP Client?

Doing a wip_netExit means to release all resources inclusive of the wip_netInit and GPRS bearer declaration and having to re-declare all this again.
Is there a smarter way to do a reconnection that anyone can suggest

Besides the question to some of the developers out there:

How do you reconnect when you are not in GPRS range. At present, i am using AT+CREG? to detect if GPRS exists or it doesn’t exist. I sorta call that AT command every 1 sec or so.

What i found out is, for a short period of time, it works fine, but when you let it run long enough, that’s when i get very unexpected results.

Like i simulated lost of GPRS for 6 hours or so, and there was a UART command on terminal that says

BUSY:GPRS Exist

+WIND: 8

+CREG: 0

Then on, i couldn’t even detect GPRS anymore. Not sure what caused this to happen…

Another scenario is the use of

wip_tcpclientcreate

I was trying it on the server the other day, creating a new socket every 10 secs and closing it just to test the modem. After like 10 tries or so, i couldn’t perform wip_tcpclientcreate, channel wasn’t created and no events were called (WIP_WRITE/OPEN).

On the server side, we have a network diagnostics and it shows that the connection was established. ON certain occasion, a WIP_CEV_ERROR will come out after 20-30 mins (sometimes never), and then it works fine again.

So question is, is this a modem issue or the server issue. The channel is not created, thus closing it didn’t do anything. And what took the WIP_CEV_ERROR to come back so long, and sometimes, it doesn’t even come back.

I know this post is everywhere, but i am trying my best to segment and give the best account. Anyone care to assist? I’m sure anyone using GPRS has to have some sort of protocol to reconnect