Valgrind shows a memory leak:

==465== Memcheck, a memory error detector
==465== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==465== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==465== Command: ./test
==465== 
exit(ATS): uncaught exception at run-time:
test.dats:MyException(1024)
==465== 
==465== HEAP SUMMARY:
==465==     in use at exit: 40 bytes in 2 blocks
==465==   total heap usage: 2 allocs, 0 frees, 40 bytes allocated
==465== 
==465== LEAK SUMMARY:
==465==    definitely lost: 24 bytes in 1 blocks
==465==    indirectly lost: 0 bytes in 0 blocks
==465==      possibly lost: 0 bytes in 0 blocks
==465==    still reachable: 16 bytes in 1 blocks
==465==         suppressed: 0 bytes in 0 blocks
==465== Rerun with --leak-check=full to see details of leaked memory
==465== 
==465== For counts of detected and suppressed errors, rerun with: -v
==465== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)




On Thursday, June 20, 2019 at 1:37:49 PM UTC-5, aditya siram wrote:
>
> This program for instance compiles:
>
> exception MyException of (list_vt(int))
>
> fun test(l : list_vt(int)): void =
>     $raise MyException(l)
>
> implement main0(argc,argv) = 
>   test(list0_vt_cons(1,list0_vt_nil()))
>
>
> but results in:
> exit(ATS): uncaught exception at run-time:
>
>
> I expect that but would also have expected that the type system would 
> require me to free 'l' at some point.
>
>
> On Thursday, June 20, 2019 at 12:35:14 PM UTC-5, aditya siram wrote:
>>
>> Hi,
>> That is closer but what I had in mind is what happens with an exception 
>> carries a linear resource, so in that example, imagine the exception was on 
>> the '~(x :: xs)' case and looked something like '$raise Exception(x)'. Here 
>> 'x' of type 'a' must be consumed whenever the exception is handled. My 
>> question is if the linear type system detects such cases.
>>
>>
>> On Thursday, June 20, 2019 at 12:19:09 PM UTC-5, Richard wrote:
>>>
>>> Hello Aditya,
>>>
>>> I know this is not identical but checkout this example,
>>>
>>> https://github.com/githwxi/atslangweb/blob/master/ats2-lang/doc/EXAMPLE/INTRO/sieve_llazy.dats#L53
>>>
>>> The tilde tells the compiler to free the empty stream in this example.
>>>
>>> Is this similar to what you have in mind?
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/6ba9272d-424a-431f-b33e-482483653b23%40googlegroups.com.

Reply via email to