Hi
I'm using RadBook and Pdf viewer as follow:
Xaml Code:
<UserControl.Resources> <DataTemplate x:Key="LeftPageTemplate"> <Viewbox> <Grid> <UI:FixedDocumentSinglePagePresenter Page="{Binding}" Width="325" Height="447" FlowDirection="LeftToRight"/> <hosts:DrawingCanvas Width="325" Height="447" Margin="15" Background="#00000000" FlowDirection="LeftToRight" /> </Grid> </Viewbox> </DataTemplate></UserControl.Resources><telerik:RadBusyIndicator x:Name="BusyIndicator"> <telerik:RadBook x:Name="book" LeftPageTemplate="{StaticResource LeftPageTemplate}" RightPageTemplate="{StaticResource LeftPageTemplate}" IsVirtualizing="True" IsKeyboardNavigationEnabled="True" HorizontalAlignment="Center" VerticalAlignment="Center" FirstPagePosition="Right" HardPages="None" Margin="10" BorderThickness="1" BorderBrush="{telerik:Windows8Resource ResourceKey=BasicBrush}"/></telerik:RadBusyIndicator>C# Code:
public void LoadFile(Stream stream){ BusyIndicator.IsBusy = true; var UISyncContext = TaskScheduler.FromCurrentSynchronizationContext(); var task = new Task<RadFixedDocument>(() => LoadPdf(stream)); task.ContinueWith(t => { book.ItemsSource = t.Result.Pages; TotalPages = t.Result.Pages.Count; BusyIndicator.IsBusy = false; }, UISyncContext); task.Start();}private RadFixedDocument LoadPdf(Stream stream){ return new PdfFormatProvider(stream, FormatProviderSettings.ReadOnDemand).Import();}Everything seems to work fine!
But the problem is when I Load a file and start browsing pages, and monitor it on Task Manager, memory grows too high (i.e. more than 2GB)
Look at the attached files, one from Task manager and one from ANTS Memory Profiler!
What's wrong with my code? Should I do some extra work like releasing objects, pages, ... any thing!?
