View Issue Details

IDProjectCategoryView StatusLast Update
0032006Open CASCADEOCCT:Foundation Classespublic2023-08-01 15:08
Reporterkgv Assigned Toabv 
Status newResolutionopen 
Product Version6.6.0 
Target VersionUnscheduled 
Summary0032006: Foundation Classes - OSD_MemInfo returns negative heap value
DescriptionOSD_MemInfo returns negative values for MemHeapUsage counter on Linux when exceeding 2GB:
Draw[10]>   Private memory:     6011 MiB
  Working Set:        6054 MiB (peak: 6108 MiB)
  Virtual memory:     6297 MiB
  Heap memory:     -362 MiB

This is because implementation relies on obsolete GLibc-specific function mallinfo() returning 32-bit signed integer numbers.

Apart from overflow, mallinfo::uordblks is also known to return counter only for a first arena, while several arenas might be allocated - hence, unreliable for computing overall private allocations.

Unfortunately, there is no mallinfo() alternative compatible with 64-bit address space.
Instead, there are other functions available like malloc_info() returning memory info in an XML form.
       int malloc_info(int options, FILE *stream);

Some applications implement an XML parser (with help of open_memstream() for creation of in-memory file).
While this could be slower than mallinfo() call, it seems this is the only way for computing reliable Heap values.
TagsNo tags attached.
Test case number


parent of 0032319 closedbugmaster Foundation Classes, OSD_MemInfo - use mallinfo2() instead of deprecated mallinfo() 
child of 0023818 closedomy Extend OSD_MemInfo to report C heap statistics 


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-12-17 22:25 kgv New Issue
2020-12-17 22:25 kgv Assigned To => abv
2020-12-17 22:26 kgv Relationship added child of 0023818
2020-12-17 22:26 kgv Product Version 7.5.0 => 6.6.0
2021-04-22 20:41 kgv Relationship added parent of 0032319
2021-09-09 21:39 kgv Target Version 7.6.0 => 7.7.0
2022-10-24 10:40 szy Target Version 7.7.0 => 7.8.0
2023-08-01 15:08 dpasukhi Target Version 7.8.0 => Unscheduled