-
November 22nd, 2013, 09:45 AM
#1
load/encrypt large files error memory out of exception
it works with small files.but when I try to do with large files it gives system out of memory excetion.Please sir help me.I want change that coding using streamreader with a loop to store memory in chunks of bytes
blow is short code.
i want change the list line and want use stream reader for that to read if possible i want use a while loop
public byte[] Secure(byte[] Data){
//my encrypt function ....
}
.....
string F = null;
...
...
byte[] file1 = Secure(File.ReadAllBytes(textBox1.Text));
Last edited by yousufshah; November 22nd, 2013 at 09:47 AM.
-
November 22nd, 2013, 01:31 PM
#2
Re: load/encrypt large files error memory out of exception
You'll have to compute the size of the file, and then create a pointer for where you are, and a pointer from the starting place (0). Then keeping track of the two, compute a block size to use that won't eat up all the memory. 1024 byte increments might work best
-
November 23rd, 2013, 10:27 AM
#3
Re: load/encrypt large files error memory out of exception
thank you mister dglienna.Thanks for response.I know that your solution will 100% work.but please help me in code.
I want recode that line as you tells
byte[] file1 = Secure(File.ReadAllBytes(textBox1.Text));.
and secure function only accetpes
public byte[] Secure(byte[] Data){
//my encrypt function ....
}.
so please help me more
-
November 24th, 2013, 03:58 PM
#4
Re: load/encrypt large files error memory out of exception
Originally Posted by yousufshah
thank you mister dglienna.Thanks for response.I know that your solution will 100% work.but please help me in code.
I want recode that line as you tells
byte[] file1 = Secure(File.ReadAllBytes(textBox1.Text));.
and secure function only accetpes
public byte[] Secure(byte[] Data){
//my encrypt function ....
}.
so please help me more
Convert the secure function to encrypt a list of byte[] instead of only one array and i can help you in code
(ps: the max value of a byte array is the Int32.MaxValue)
-
November 24th, 2013, 05:16 PM
#5
Re: load/encrypt large files error memory out of exception
Originally Posted by Reroto
Convert the secure function to encrypt a list of byte[] instead of only one array and i can help you in code
(ps: the max value of a byte array is the Int32.MaxValue)
thanks for hope.May I send you Full code in pm or here? i want fix that code.
thank you reroto
-
November 24th, 2013, 05:51 PM
#6
Re: load/encrypt large files error memory out of exception
Originally Posted by yousufshah
thanks for hope.May I send you Full code in pm or here? i want fix that code.
thank you reroto
Ok send or post it i'll try to help you
-
November 25th, 2013, 02:12 AM
#7
Re: load/encrypt large files error memory out of exception
textbox1.text sounds more like the problem.
-
November 26th, 2013, 08:03 AM
#8
Re: load/encrypt large files error memory out of exception
still no issue solved.please help me code.
-
November 26th, 2013, 06:51 PM
#9
Re: load/encrypt large files error memory out of exception
Inspect textbox1.text for it's value. Text is not binary data
-
November 27th, 2013, 10:35 AM
#10
Re: load/encrypt large files error memory out of exception
Originally Posted by yousufshah
thanks for hope.May I send you Full code in pm or here? i want fix that code.
thank you reroto
Originally Posted by Reroto
Ok send or post it i'll try to help you
Thanks for posting guys, and trying to help.
Just remember that posting code through PM / emails do not benefit this forum and the possible members with the same problems.
All code ( be it helpful or for purposes to understand the situation better ) must be posted in this thread, using Code tags.
Hannes
-
November 27th, 2013, 10:37 AM
#11
Re: load/encrypt large files error memory out of exception
Originally Posted by dglienna
textbox1.text sounds more like the problem.
Why?
Originally Posted by dglienna
Inspect textbox1.text for it's value. Text is not binary data
He is using ReadAllBytes to read all the bytes. As I understand, the TextBox ( textBox1 - which is not properly named ) is solely used to show the location of a file.
-
November 29th, 2013, 07:06 AM
#12
Re: load/encrypt large files error memory out of exception
textbox.text is the location of first file.I just want use binary reader wid loop to read 4 Bytesper round utill read all Bytes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|