MathGroup Archive 2007

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

Search the Archive

Re: Kernel closes after nested function returns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74732] Re: Kernel closes after nested function returns
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Mon, 2 Apr 2007 07:01:06 -0400 (EDT)
  • References: <eunqdv$7jj$1@smc.vnet.net>

Hi,

Mathematica copy the data quite often and I would expect, that you
run out of memory or the kernel need more memory than the operating 
system allows. You may hinder the copy process by using a Block[] in
func A and use in func B the variable name of func A

funcA[listInput_]:=Block[{aVeryLargeList=listInput},
    ...
    funcB[]
    ...
   ]

funcB[]:=Module[{someVariable},
    ...
    aVeryLargeList*someVariable
   ...
]

eventual with the full context.

Or you may transfer the symbol with the HoldFirst attribute
or you may use a 64 bit system.

Regards
   Jens


Lawrence Walker wrote:
> Hi,
> 
> I've been experiencing a problem where the kernel and all of my mathlink 
>   programs quits.  Upon debugging with Workbench, I saw that mathlink 
> returns an error when returning from a called function.
> 
> The scenario goes like this: I run a package containing definitions for 
> function A and function B.  When I run funcA during the notebook 
> session, I pass a very large list to funcA.  funcA then calls funcB and 
> passes the large list to it.  funcB returns its results to funcA.  Next 
> funcA finish performing all of its calculations.  Finally, funcA 
> prepares to return its results to the notebook session.  And thats when 
> the kernel quits with no warning.
> 
> After further debugging, I found that everything works when passing 
> smaller lists.  So, I suspect a memory problem.
> 
> I solved the problem by modifying funcA to not have to call funcB.  Now 
> I can work with very large lists.
> 
> But this still doesn't solve a problem that could be related to 
> Mathematica 5.2.  Does anyone know how to fix this?
> 
> Lawrence
> 


  • Prev by Date: Re: Simplification with Integers assumption
  • Next by Date: Re: Closing All Input Cells at Once- KB shortcuts
  • Previous by thread: Kernel closes after nested function returns
  • Next by thread: Re: Limiting range of variables when defining funxtions of several