MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: freeing memory used by Import[]

  • To: mathgroup at
  • Subject: [mg103693] Re: freeing memory used by Import[]
  • From: Albert Retey <awnl at>
  • Date: Fri, 2 Oct 2009 08:26:15 -0400 (EDT)
  • References: <h4h21g$id4$> <h56bka$bli$> <ha21d6$ndn$>

markus wrote:
> On 3 Aug., 11:45, divisor <congruentialumina... at> wrote:
>> Hello MathGroup:
>> As a result of some help from WRI support, the behavior is much more
>> clear to me now. I actually am not sure if it is a bug and I don't
>> know if it can be fixed in a subsequent release.
>> Basically what is happening is that the result of the earlier
>> invocations are always in Out[n]. This is designed this way (from the
>> first Mathematica version, I guess) in order to support the "%-m" construct.
>> This is (of course) controlled by the $HistoryLength system variable.
>> Since this application does not need to use "%-100" or "%-1000" (which
>> are fully supported by Mathematica) it can run with a much smaller
>> $HistoryLength setting. In fact, I will probably use 1 or 2 since I
>> just need to Export[] the graphic once it is rendered.
>> I cannot imagine I could get this to work without help from the
>> vendor.
>> Regards..
>> Roger Williams
>> Franklin Laboratory
>> On Jul 26, 12:53 am, divisor <congruentialumina... at> wrote:
>>> Hello MathGroup:
>>> Somehow running the following command a few times depletes all of the
>>> free <snipped/>
> But from my experience, even using $HistoryLength=1 does not solve the
> problem of memory leakage. After a large dataset has been loaded, it
> somehow remains in the memory and you can not get rid of it again
> unless you restart Mathematica. Remove[..] also does not work.
> If this is not a bug then I don't know...

Have you checked that it is really the kernel which leaks memory?

I have not had problems since I'm probably not importing large enough
files, but I think that most (or at least some) import-functions use
extra processes or Java to do the import stuff (see
$InstallDirectory/SystemFiles/Converters to see what makes me think this
is so). And I think these extra processes (or the java vm) stay in
memory once they have been used. I'm not sure if the above is correct
and true for all versions, so maybe someone else can give more precise

If it would really be the extra processes or the java vm, you probably
could stop these to regain the memory and let mathematica restart them
for the next import. I know that this can be done for java but I don't
know if this is possible for the extra processes in a clean way, but
probably you would just need to LinkClose or Uninstall the correct
LinkObjects. Nevertheless It would be nice if this behavior would be
better documented and easier to control (or not necessary to even think
about it)...



  • Prev by Date: Re: Re: reference manager in Mathematica?
  • Next by Date: Re: Re: reference manager in Mathematica?
  • Previous by thread: Re: freeing memory used by Import[]
  • Next by thread: Re: OneIdentity