C# Task .Cancel take a lot of memory and it is not the same as .Abort in thread
<p>I have problem with <code>.Cancel</code> and <code>.Wait</code> in tasks. It takes a lot of memory and time.</p>

<p>Tasks:</p>

<pre><code>using (CancellationTokenSource cancelSource = new CancellationTokenSource())
{
    CancelEventArgs args = new CancelEventArgs(false);
    Task task = Task.Factory.StartNew(() =&gt;
    {
        try
        {
            action(args);
        }
        catch (Exception ex)
        {
            exception = ex;
        }
    }, cancelSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Current);

    bool success = task.Wait(maxRuntime);
    if (!success)
    {
        cancelSource.Cancel();
        return false;
    }
}
</code></pre>

<p>In C# threading I use <code>.Abort</code> for aborting threads. Here in tasks I use <code>.Cancel.</code> But I think that <code>.Cancel</code> takes a lot of memory and time and it is not the same as <code>.Abort</code> in threads. How can I decrease memory when using </p>

<pre><code>bool success = task.Wait(maxRuntime);
if (!success)
{
    cancelSource.Cancel();
    return false;
}
</code></pre>

<p>Threading example:</p>

<pre><code>Thread workerThread = new Thread(threadStart);

workerThread.Start();

bool finished = workerThread.Join(timeout);
if (!finished)
    workerThread.Abort();

return finished;
</code></pre>
