Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Heap Memory Usage Growth Cause Overflow

Heap Memory usage growth cause overflow

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By fery_rz , 14 October, 2019
Forums
General discussion

Hello,
I used GuruxDLMS.c running on ESP32 microcontroller, to read data from SL7000 meter.
I have success to read meter clock & serial number, for testing I read it every one second.
after run for several minutes, the microcontroller is crash. when I monitor the Free Heap, it show the heap used several bytes after we call "com_read" function, so the available heap decreased every we call it, and causes system reset when it reach the lower point.
is it normal? can we clear object or something to free the heap used after calling "com_read" function.

Best regards,
Fery

Profile picture for user Kurumi

Kurumi

6 years 8 months ago

Hi,

Hi,

What value did you try to read? You should call var_clear after you have read the value.

BR,
Mikko

fery_rz

6 years 8 months ago

I try reading meter time

I try reading meter time (clock), and the value is read successfully, then print it to serial console, I use:
//Read clock.
ret = com_read(&clock1.base, 2);
if (ret != DLMS_ERROR_CODE_OK)
{
return;
}

Serial.printf("%02d-%02d-%04d %02d:%02d:%02d\r\n",
clock1.time.value.tm_mday,
clock1.time.value.tm_mon,
clock1.time.value.tm_year + 1900,
clock1.time.value.tm_hour,
clock1.time.value.tm_min,
clock1.time.value.tm_sec);

and the output is correct: "14-09-2019 16:15:50"

were I must put "var_clear()", and what value must be passed to it?
is there any example?

Regards,
Fery_rz

Profile picture for user Kurumi

Kurumi

6 years 8 months ago

Hi,

Hi,

This looks correct. Are you creating clock by yourself or are you reading association view?
We'll check this right away.

BR,
Mikko

fery_rz

6 years 8 months ago

Thank you Mikko,

Thank you Mikko,
I use this, the OBIS i get from GXDLMSDirector.
gxClock clock1;
cosem_init(&clock1.base, DLMS_OBJECT_TYPE_CLOCK, "0.0.1.0.0.255");

when I try to monitor the heap, befor and after calling "ret = com_read(&clock1.base, 2);", then subtract it, it use 144 bytes.
I try reading another value from the meter, for example I read the meter serial number using "com_read(&data1.base, 2);" it used different size.

and the free heap always decreased after we call it function, that use "com_read" inside,.
how about "var_clear()", is there any example usage of it?

Best regards,
Fery

Profile picture for user Kurumi

Kurumi

6 years 8 months ago

Hi

Hi

You need to call var_clear for data and register if you -re-create object.
We found a memory leak issue from the client-side that is fixed and new version is released.
Get the latest version.

Thank you for pointing this out.

BR,

Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin