<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoPlainText>Good day!<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>I am experiencing a memory leak from looped calls to
GDALRasterIO(). It may be something I am doing improperly <br>
because I use/call RasterIO() in a C++ program that runs leak free.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>I "migrated" the C++ code to the GDAL C API so
that I can integrate some really old C code downstream from the GDALRasterIO()
call.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>The leak was observed on v1.5.2, so I upgraded to 1.7.2
and am experiencing the same effect. <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Are there special options or considerations when
compiling C code against the GDAL library?<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Any suggestions?<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>KFW<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>==29880== 736,992 bytes in 10,236 blocks are possibly
lost in loss record 1,122 of 1,126<o:p></o:p></p>
<p class=MsoPlainText>==29880== at 0x4A0666E: operator
new(unsigned long) (vg_replace_malloc.c:220)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x50256FA:
GDALRasterBand::GetLockedBlockRef(int, int, int) (gdalrasterband.cpp:1230)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5035C94:
GDALRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void*, int, int,
GDALDataType, int, int) (rasteri\<o:p></o:p></p>
<p class=MsoPlainText>o.cpp:228)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x40CD44: main
(fragstatCutter.c:254)<o:p></o:p></p>
<p class=MsoPlainText>==29880==<o:p></o:p></p>
<p class=MsoPlainText>==29880== 3,244,032 bytes in 99 blocks are possibly lost
in loss record 1,123 of 1,126<o:p></o:p></p>
<p class=MsoPlainText>==29880== at 0x4A05E1C: malloc
(vg_replace_malloc.c:195)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x50255E6:
GDALRasterBand::AdoptBlock(int, int, GDALRasterBlock*) (gdalrasterband.cpp:820)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5025732: GDALRasterBand::GetLockedBlockRef(int,
int, int) (gdalrasterband.cpp:1242)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5035C94:
GDALRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void*, int, int,
GDALDataType, int, int) (rasteri\<o:p></o:p></p>
<p class=MsoPlainText>o.cpp:228)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x40CD44: main (fragstatCutter.c:254)<o:p></o:p></p>
<p class=MsoPlainText>==29880==<o:p></o:p></p>
<p class=MsoPlainText>==29880== 14,709,648 bytes in 1 blocks are possibly lost
in loss record 1,124 of 1,126<o:p></o:p></p>
<p class=MsoPlainText>==29880== at 0x4A05E1C: malloc
(vg_replace_malloc.c:195)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5051927: VSIMalloc2
(cpl_vsisimple.cpp:622)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x4EF9837:
HFABand::LoadExternalBlockInfo() (hfaband.cpp:406)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x4EF9C0E:
HFABand::LoadBlockInfo() (hfaband.cpp:292)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x4EFA1B7:
HFABand::GetRasterBlock(int, int, void*, int) (hfaband.cpp:1029)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x4EFD85F: HFARasterBand::IReadBlock(int,
int, void*) (hfadataset.cpp:966)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5025756:
GDALRasterBand::GetLockedBlockRef(int, int, int) (gdalrasterband.cpp:1249)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5035C94:
GDALRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void*, int, int,
GDALDataType, int, int) (rasteri\<o:p></o:p></p>
<p class=MsoPlainText>o.cpp:228)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x40CD44: main
(fragstatCutter.c:254)<o:p></o:p></p>
<p class=MsoPlainText>==29880==<o:p></o:p></p>
<p class=MsoPlainText>==29880== 41,930,752 bytes in 10,237 blocks are possibly
lost in loss record 1,125 of 1,126<o:p></o:p></p>
<p class=MsoPlainText>==29880== at 0x4A05E1C: malloc
(vg_replace_malloc.c:195)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x50288BF:
GDALRasterBlock::Internalize() (gdalrasterblock.cpp:477)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x502571A:
GDALRasterBand::GetLockedBlockRef(int, int, int) (gdalrasterband.cpp:1235)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x5035C94:
GDALRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void*, int, int,
GDALDataType, int, int) (rasteri\<o:p></o:p></p>
<p class=MsoPlainText>o.cpp:228)<o:p></o:p></p>
<p class=MsoPlainText>==29880== by 0x40CD44: main
(fragstatCutter.c:254)<o:p></o:p></p>
<p class=MsoPlainText>==29880==<o:p></o:p></p>
<p class=MsoPlainText>==29880== LEAK SUMMARY:<o:p></o:p></p>
<p class=MsoPlainText>==29880== definitely lost: 0 bytes in 0
blocks<o:p></o:p></p>
<p class=MsoPlainText>==29880== indirectly lost: 0 bytes in 0
blocks<o:p></o:p></p>
<p class=MsoPlainText>==29880== possibly lost:
60,673,946 bytes in 21,287 blocks<o:p></o:p></p>
<p class=MsoPlainText>==29880== still reachable:
4,295,148,058 bytes in 1,357 blocks<o:p></o:p></p>
<p class=MsoPlainText>==29880==
suppressed: 0 bytes in 0 blocks<o:p></o:p></p>
<p class=MsoPlainText>==29880== Reachable blocks (those to which a pointer was
found) are not shown.<o:p></o:p></p>
<p class=MsoPlainText>==29880== To see them, rerun with: --leak-check=full
--show-reachable=yes ==29880==<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>