On Fri, Apr 24, 2009 at 11:56 PM, Dan Kegel <[email protected]> wrote:
> On Fri, Apr 24, 2009 at 4:09 AM, Kelemen Balazs
> <[email protected]> wrote:
>> with --leak-check=yes this leads to a definetely lost error:
>>
>> int main()  {
>>    void* p = malloc(20);
>>    unsigned pAsUint = reinterpret_cast<unsigned>(p);
>>    p = 0;
>> }
>>
>> Is this the expected behavior of valgrind?
>
> Yes, because pAsUint goes out of scope.  If you
> make it static, the lost error turns into a 'still reachable'.

Or, to put it more directly: yes, because your program has a memory leak.

Nick

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to