TOPIC: Blank pages in print preview
#858
Blank pages in print preview 3 Years, 3 Months ago
Hi, I have a little problem in print preview of reports.
When a report has more than one page, when I click on 'next', the next pages are displayed well. But after that, if I click on 'prev' button, the pages are displayed blank... And any button I click on will show only blank pages.
Have you ever experienced a similar issue? An idea on what could be?
 
 
Mauro
 
#859
Re:Blank pages in print preview 3 Years, 3 Months ago
Look at PreviewPageControl nextpage. If the emf for the page is bigger than 500k then it does not save it. One cause can be large images on the page.

This is because repeatedly allocating > 500 k blocks of memory can lead to memory issues. This was with the old memory manager which had a maximum heap size. It may not be a problem with the new Boehm memory manager.

You could try removing the limit and watch your MemoryArena(). If you try this, let me know what you find out.

If this is not the cause of the blank pages then maybe it is a new bug.
 
 
andrew
 
#860
Re:Blank pages in print preview 3 Years, 3 Months ago
Thank you Andrew. :) It was just that 500K limit that prevented the page printing in the preview, being that in some reports I have a bmp image of about 1MB in size.
I have tried to increase that limit to 5MB and do a MemoryArena() before and after the page printing (clicked next and prev button many times). The MemoryArena() result jumped from 4MB to 12MB, but after that it appears to not grow anymore if I do another report preview.
Do you think it is safe to stay with 5MB as limit?
 
 
Mauro
 
#861
Re:Blank pages in print preview 3 Years, 3 Months ago
As long as the memory doesn't grow it should be fine. Thanks for checking this.

Someone else asked me about this recently. If we're going to keep a limit maybe we should give a warning when a page isn't saved so you know what's happening.
 
 
andrew
 
#879
Re:Blank pages in print preview 3 Years, 3 Months ago
Hi Andrew, I have added other bmp images to my report and I have removed that 500K limit from PreviewPageControl. Now the memory size for the suneido.exe process grows very fast if I click next and previous many times in the pdf preview. The problem is that when I close the page preview window, the memory for pdf preview it is still allocated. If the memory arena grows up to, for example, 300MB, then after I close the page preview window, a MemoryArena() shows that are still allocated 300MB.
There is a way to solve this issue? How can I free this not used memory, after a page preview window is closed?
 
 
Mauro
 
#880
Re:Blank pages in print preview 3 Years, 3 Months ago
This is why the limit was there.

I think there is an option for the Boehm memory manager to shrink the heap when possible. This might help, but it might not ... The problem is that often, while the heap is large, some space gets allocated at the end of the heap that stays in use. This prevents the heap from shrinking, even though most of it is not being used.

Another approach might be to allocate the memory for the preview pages from another heap - e.g. use LocalAlloc.

Something else that might help would be for preview to keep a block of memory until it is closed. If a larger block was needed it would free the old one and keep the bigger one.

If you could somehow "stream" the data from the metafile to the disk file in smaller blocks then you would not have this problem.

Another option (but a bigger change) would be to save the pages before "rendering" i.e. as the Suneido VertFormat that is built for each page. Although this might not work properly if people write formats that have side-effects (because they might not give the same results when rendered later).

Post edited by: andrew, at: 2007/05/06 00:05
 
 
andrew
 
#884
Re:Blank pages in print preview 3 Years, 3 Months ago
From what you say it appears to me that this is a problem of the Suneido C++ memory management source code and that there isn't a way to solve it by modding the stdlib. So, until the issue is not resolved in the source code, it is advisable to not use images in the reports (unless they are very little in size), right?
 
 
Mauro
 
#887
Re:Blank pages in print preview 3 Years, 3 Months ago
I think some of the options (like re-using the same memory block) could be done at the stdlib level.

Problems like these are part of the reason I changed to the Boehm memory manager. It is better than my old code, but it is very hard to make conservative garbage collection "perfect".

I would suggest keeping the images in your reports, but leaving a limit in preview. This means that sometimes you cannot go previous in a preview, but our users have not had a problem with this.
 
 
andrew
 
#891
Re:Blank pages in print preview 3 Years, 3 Months ago
andrew wrote:
[...]I would suggest keeping the images in your reports, but leaving a limit in preview. This means that sometimes you cannot go previous in a preview, but our users have not had a problem with this.Yes, I think for now this is the best option. I use some background images for my reports that are very cool and I don't want to remove them only because I cannot go previous in the preview when there are more pages...
 
 
Mauro