Click here to Skip to main content
15,914,071 members
Home / Discussions / C#
   

C#

 
AnswerRe: Web browser in asp.net Pin
Not Active16-Dec-10 2:19
mentorNot Active16-Dec-10 2:19 
Questionsolution for reading Belgian eID's Pin
Eli Nurman15-Dec-10 23:53
Eli Nurman15-Dec-10 23:53 
AnswerRe: solution for reading Belgian eID's Pin
OriginalGriff16-Dec-10 0:49
mveOriginalGriff16-Dec-10 0:49 
GeneralRe: solution for reading Belgian eID's Pin
Eli Nurman16-Dec-10 1:03
Eli Nurman16-Dec-10 1:03 
QuestionCreating Bitmap with external pixel data in byte[] array GC problem Pin
Chesnokov Yuriy15-Dec-10 21:01
professionalChesnokov Yuriy15-Dec-10 21:01 
AnswerRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
OriginalGriff15-Dec-10 21:38
mveOriginalGriff15-Dec-10 21:38 
GeneralRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
Chesnokov Yuriy15-Dec-10 21:45
professionalChesnokov Yuriy15-Dec-10 21:45 
AnswerRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
Luc Pattyn16-Dec-10 0:32
sitebuilderLuc Pattyn16-Dec-10 0:32 
1. If you don't mind temporarily having the data in memory twice, I would suggest you immediately create a second bitmap from the first, then delete the first and the byte array.

2.
You could also try and use a stream, however filling a MemoryStream with BMP data, then creating a Bitmap from the stream, isn't any better than the first approach.

3.
If you do mind the increased memory footprint and the copying cycles, I'm afraid you need explicit memory management for both the image and the array. The easiest would be to derive from Bitmap and keep the byte array pointer inside the derivative; unfortunately Bitmap is sealed. The next best approach IMO would be to have a static Dictionary<Bitmap, byte[]> where you keep the mapping alive for as long as (you think) the image lives. This of course would be a cooperative approach, as removing an image that is still in use somewhere would still be open to failure.


Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

AnswerRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
_Erik_16-Dec-10 4:55
_Erik_16-Dec-10 4:55 
GeneralRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
Chesnokov Yuriy16-Dec-10 8:21
professionalChesnokov Yuriy16-Dec-10 8:21 
GeneralRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
harold aptroot16-Dec-10 8:49
harold aptroot16-Dec-10 8:49 
GeneralRe: Creating Bitmap with external pixel data in byte[] array GC problem Pin
_Erik_16-Dec-10 10:25
_Erik_16-Dec-10 10:25 
QuestionSetting Crystal Report printer option to a Network printer Pin
HatakeKaKaShi15-Dec-10 15:12
HatakeKaKaShi15-Dec-10 15:12 
AnswerRe: Setting Crystal Report printer option to a Network printer Pin
thatraja15-Dec-10 20:16
professionalthatraja15-Dec-10 20:16 
QuestionDefault or optional Parameters in C# Pin
indian14315-Dec-10 6:38
indian14315-Dec-10 6:38 
AnswerRe: Default or optional Parameters in C# Pin
Rob Philpott15-Dec-10 6:40
Rob Philpott15-Dec-10 6:40 
GeneralRe: Default or optional Parameters in C# Pin
PIEBALDconsult15-Dec-10 7:19
mvePIEBALDconsult15-Dec-10 7:19 
AnswerRe: Default or optional Parameters in C# Pin
Luc Pattyn15-Dec-10 7:17
sitebuilderLuc Pattyn15-Dec-10 7:17 
GeneralRe: Default or optional Parameters in C# Pin
indian14315-Dec-10 11:40
indian14315-Dec-10 11:40 
AnswerRe: Default or optional Parameters in C# Pin
Abhinav S15-Dec-10 17:27
Abhinav S15-Dec-10 17:27 
GeneralRe: Default or optional Parameters in C# Pin
PIEBALDconsult16-Dec-10 2:10
mvePIEBALDconsult16-Dec-10 2:10 
GeneralRe: Default or optional Parameters in C# Pin
Fabio Franco16-Dec-10 9:38
professionalFabio Franco16-Dec-10 9:38 
GeneralRe: Default or optional Parameters in C# Pin
PIEBALDconsult16-Dec-10 14:27
mvePIEBALDconsult16-Dec-10 14:27 
AnswerRe: Default or optional Parameters in C# Pin
RaviRanjanKr15-Dec-10 17:38
professionalRaviRanjanKr15-Dec-10 17:38 
AnswerRe: Default or optional Parameters in C# Pin
Roger Wright15-Dec-10 18:41
professionalRoger Wright15-Dec-10 18:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.