Re: memory management



On 31 Okt., 14:18, Lew <l...@xxxxxxxxxxxxx> wrote:
Thomas Kellerer wrote:
As far as I can tell, this will create huge strings with the complete
result set, as they are declared outside the loop (actually twice the
result set because one for the out_Record and one for the in_record).
Ingo Menger wrote:
Actually 4-fold, since at the end he does:

log += out_record + in_record;
//out.print(st);
out.print(log);

Just changing this will save 50% memory:

Actually even more than that, because all the intermediate strings are there
from each iteration.

Sure, but the intermediates can be collected. But the "log +=
out_record + in_record" just doubles (at least) the need for
*accessible* memory in one sweep.

Given n iterations, aren't there O(n^2) Strings generated?

Certainly. Wich will give the gc a hard time. The program should not
only use huge amounts of memory but also many ticks in the gc.

.



Relevant Pages

  • Re: Fast string operations
    ... > is why people use unsafe code now and then to use pointer arithmetic to ... > loop over arrays without all the unnecessary bounds checking. ... don't return the trimmed string". ... The customer perceives this as a memory leak. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Performance Improvement of complex data structure (hash of hashes of hashes)
    ... Anno Siegel wrote: ... >> Here is the code that I'm using to build up this data structure. ... loop through and increment the ... I know that memory allocation in C is expensive, ...
    (comp.lang.perl.misc)
  • Re: Cost of calling a standard library function
    ... It accesses/reads memory using esi 4 ... > safly move it within the cache, without having to go via ebx. ... try it the same thing on a different earlier CPU, ... should check it out...for "tight inner loop" stuff, ...
    (alt.lang.asm)
  • Re: Restoring a NorthStar Horizon, problems with SRAM board
    ... A-D FDC is a memory mapped IO device so I would expect some behavior ... loop read/write functions - which puts the system into a two instruction ... SRAM on the Vector Graphics Flashwriter video card located at $F000 ...
    (comp.sys.northstar)
  • Re: Bimini Twist in 50lb Power Pro
    ... > fishing I do not normally choose to use any loop to loop connection ... > my bass taper fly line and continuous mono leader. ... Does Power Pro retain memory? ... I've never experienced any memory with PP, whether using it in fresh water ...
    (rec.outdoors.fishing.bass)