ResourceImpl unload throws out of memory [message #423564] |
Thu, 02 October 2008 12:17 |
Radu Bretean Messages: 7 Registered: July 2009 |
Junior Member |
|
|
Hello, I have an Out of Memory problem,
due to 'unload' method from ResourceImpl class. The file loaded into
ResourceImpl has the size of 160 MB. I've made some optimization into my
application that allows me to load this file is several seconds, to 1
minute (depend on the PC), but when the file must be unloaded (e.g.
because the project was closed), the application crash with out of
Memory. I've locked into the unload method and it seems that,
it is making a duplicate of the entire resource content (which leads to
out of memory, because a lot of memory is already taken). Why is doing
this? Why does not traverse current content and remove the adapters from
the objects and then delete them. Is there any elegant way to
bypass duplication of the resource content? Not only that require a lot of
memory, but also, takes a lot of time to do it. For me does not seems
normal to load a file in 1 minute and to spend 10 minute on unloading
it. Thank you, Radu
|
|
|
Re: ResourceImpl unload throws out of memory [message #423567 is a reply to message #423564] |
Thu, 02 October 2008 12:35 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Radu,
Comments below.
Radu Bretean wrote:
> Hello, I have an Out of Memory problem,
An encoding one too. :-P
> due to 'unload' method from ResourceImpl class. The file loaded into
> ResourceImpl has the size of 160 MB. I've made some optimization into
> my application that allows me to load this file is several seconds, to
> 1 minute (depend on the PC), but when the file must be unloaded (e.g.
> because the project was closed), the application crash with out of
> Memory. I've locked into the unload method and it seems
> that, it is making a duplicate of the entire resource content (
No, it's not. It's walking the tree and setting the proxy URI on each
object. This unfortunately takes significant space.
> which leads to out of memory, because a lot of memory is already
> taken). Why is doing this? Why does not traverse current content and
> remove the adapters from the objects and then delete them.
What does deleting mean though? The idea is that it needs to convert
them to proxies, so that any references to the objects will reresolve
themselves.
> Is there any elegant way to bypass duplication of the
> resource content?
There isn't any duplication.
> Not only that require a lot of memory, but also, takes a lot of time
> to do it. For me does not seems normal to load a file in 1 minute and
> to spend 10 minute on unloading it.
If you're getting close to being out of memory, the system will thrash
pretty hard trying to collect garbage to no avail, so the performance
while in the state of running out of memory will not necessarily be
indicative of normal performance.
If you don't need the objects to become proxies, because there are no
incoming references to objects in the resource, you could specialize
unloaded to forgo that step.
Why are you unloading?
> Thank you, Radu
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: ResourceImpl unload throws out of memory [message #423586 is a reply to message #423577] |
Thu, 02 October 2008 15:39 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------000408000905020405040109
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Radu,
The doUnload method is not final. And you might only want to specialize
the *unloaded *method to not do the proxy conversion.
Radu Bretean wrote:
> Thank you for your quick answer. OK, you convince
> me that is not duplicating the tree content, but traverse it to set
> proxy URI. Because unload method is final, the only
> solution that I have is to implement my own method (e.g. unloadX) that
> unload the resource without traversing it. Radu
>
--------------000408000905020405040109
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Radu,<br>
<br>
The doUnload method is not final.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.05841 seconds