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. Memory Leak Issue In Profilegeneric

Memory leak issue in Profilegeneric

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 Jaimit , 12 August, 2020
Forums
Gurux.DLMS

I am trying to read Loadprofile from profile generic.
but every time when i try to read data,it will occupy some memory (some bytes) which will not free.for example when i try to print "Get Free heap Size" after reading data then for 1'st time it is 172868(bytes),2'nd time 172352(bytes),3'rd time 171830 etc.. so every time it will occupy around 400 to 500 bytes.

Please help me to solve this issue. My code is as below.I am using ESP32 controller.

In this code,i am comparing obiscode,if obiscode match with loadprofile obiscode then i will read data from loadprofile and then free the memory.
but still it occupy some memory every time.
(i am rotating 'for' loop till loadprofile then break the loop)

oa_init(&objects);
ret = oa_getObjects(&_meterSettings.objects, DLMS_OBJECT_TYPE_PROFILE_GENERIC, &objects);
dlmsbb_init(&ba);

for (pos = 0; pos != objects.size; ++pos)
{
oa_getByIndex(&objects, pos, (gxObject**)&pg_1);

if(Loadprofile obiscode)
{
com_read((gxObject*)pg_1, 3);
com_readRowsByEntry(pg_1, 1, 5);

for (r = 0; r != pg_1->buffer.size; ++r)
{
ret = arr_getByIndex(&(pg_1->buffer), r, (void**)& va);

for (c = 0; c != va->size; ++c)
{
ret = va_getByIndex(va, c, &tmp);

ret = arr_getByIndex(&(pg_1->captureObjects), c, (void**)& kv);

//reading load profile data here
}
}
obj_clearProfileGenericCaptureObjects(&(pg_1->captureObjects));
obj_clearProfileGenericBuffer(&(pg_1->buffer));
arr_clear(&(pg_1->buffer));
arr_clearKeyValuePair(&(pg_1->buffer));
oa_empty(&objects);
oa_clear(&objects);
bb_clear(&ba);
break;
}
}

Profile picture for user Kurumi

Kurumi

5 years 11 months ago

Hi,

Hi,

I believe that the object that is in capture objects is not in read association view.
Add after obj_clearProfileGenericCaptureObjects method:
oa_clear(&_meterSettings.releasedObjects);

Also calling cl_clear(&_meterSettings) will clear the released objects.

BR,

Mikko

BR,
Mikko

Jaimit

5 years 11 months ago

Thanks for the answer.

Thanks for the answer.

when i use oa_clear(&_meterSettings.releasedObjects) and cl_clear(&_meterSettings) method,it will clear all objects from read association view.so i need to read association view every time after using this method.But in my code i read Association view only one time.

Profile picture for user Kurumi

Kurumi

5 years 11 months ago

Hi,

Hi,

I believe that you are reading the association view only once? Can you read the capture objects also only once? Is that helping?

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
More

Who's new

  • Dawley07
  • nostra
  • cuiVEAwINCoyynjjn
  • qlMlMNfbqjNumKgGFIo
  • randx-super.ru
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin