MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0032006Open CASCADE[OCCT] OCCT:Foundation Classespublic2020-12-17 22:252020-12-17 22:26
Reporterkgv 
Assigned Toabv 
PrioritynormalSeverityminor 
StatusnewResolutionopen 
PlatformOSOS Version
Product Version[OCCT] 6.6.0 
Target Version[OCCT] 7.6.0*Fixed in Version 
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
Attached Files

- Relationships
child of 0023818closedomy Extend OSD_MemInfo to report C heap statistics 

-  Notes
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


Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker