Re: Memory usage on Win32: Euphoria usage vs. what Task Manager displays

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
DerekParnell said...
DerekParnell said...

I'll rebuild using managed mem to see if it does anything different.

Yep, using mananged_mem exhibits the effects that Andy reported. One needs to compile with System Memory in order for it to release memory.

That makes sense. They both use the windows allocation API, but the 'managed memory', which is the default, caches your freed memory for its later reuse. This is what euphoria has always done (for quite a long time, at least). This speeds up the case where there is a lot of allocation and deallocation (though not nearly as much as it used to on older windows).

Perhaps we should look into limiting the size, and after some amount, we let the memory go back to the operating system. I'm not sure how difficult it would be, but it seems like the right thing to do.

Well, if there was a change, it must have been at v3.0, because that is when I started having this problem. Like I said, I reported on this a couple of times over a year ago. Looking at the code in be_alloc.c, which I do not understand, I can nevertheless tell that the code for Windows is much more complex than for other platforms. Any chance there is actually a subtle bug in there -- an unintended change? Why, for instance, in my example when I set x = {} immediately get back 90MB? What's special about 90MB? Is it releasing one block of something and then stopping when it shouldn't?

If there is no bug, would a simple programmatic option be possible that could control that amount of caching? (e. "with cache <min/normal/large>") Which would not affect the ability to use all the memory you need, but would allow (with option "min") to release as much as possible (at the expense of alloc/dealloc speed if that's the cost) when finished in order to keep the memory usage of a process no bigger than need be for what is it currently doing? (Option normal could be normal/default and large could actually pre-allocate extra memory to keep things speedy. Or some such scheme. Possible? Smart?) Or maybe an explicit command that could be put anywhere? (e.g. "free_cache()")

Or does it actually need to be compiled differently?

It doesn't come up that often, but when it does it turns your program into a real resource hog, even when it is finished with the resources. I know Euphoria has always prided itself on automatic garbage collection, but it is holding on to the trash.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu