I've been working on a small project and have code resembling this:
Which got me thinking, is it bad practise to keep something in memory for a long time? It doesn't particularly apply here as step #2 is pretty fast so keeping it in memory isn't an issue, but is there a point where it's better to have an approach like this:
The IPA files I'm loading are anywhere from 1MB to 312MB so I'm not dealing with anything massive.
If a lot of time consuming operations are done between the two file extractions, is it better to dispose of it and initialise it again later? I know it would take more time to reload it, but wanted to know if there are any downsides to keeping it loaded. I'm not concerned about this for this particular project but just curious for future reference.
Thanks!
Code:
using (ZipFile zip = ZipFile.Read(ipaFile))
{
// Extract a certain file
// Process data from this file
// Extract further files from the zip file based on the results from the previous file
}
Which got me thinking, is it bad practise to keep something in memory for a long time? It doesn't particularly apply here as step #2 is pretty fast so keeping it in memory isn't an issue, but is there a point where it's better to have an approach like this:
Code:
using (ZipFile zip = ZipFile.Read(ipaFile))
{
// Extract a certain file
}
// Process data from this file
using (ZipFile zip = ZipFile.Read(ipaFile))
{
// Extract further files from the zip file based on the results from the previous file
}
The IPA files I'm loading are anywhere from 1MB to 312MB so I'm not dealing with anything massive.
If a lot of time consuming operations are done between the two file extractions, is it better to dispose of it and initialise it again later? I know it would take more time to reload it, but wanted to know if there are any downsides to keeping it loaded. I'm not concerned about this for this particular project but just curious for future reference.
Thanks!