I create var for my movieclip that has long animation like this:
public var swftest = Assets.getMovieClip ("library:MovieclipA");
and then I add it on screen like this:
public function animation_test()
{
s_container.addChild(swftest);
}
for some reason it causes memory leak, as if Haxe doesnt know how to handle looping animation in a movieclip... If I do swftest.gotoAndStop(1); it wont anymore cause memory leak... If I let swftest just play, it will cause crash in about 50 seconds as it takes more and more memory.
Here is snippet from project.xml where I enable loading assets from library.swf if it helps to solve this problem:
<!-- classpath, haxe libs -->
<source path="src" />
<haxelib name="openfl" />
<haxelib name="swf" />
<haxelib name="actuate" />
<!-- assets -->
<library path="Assets/library.swf" type="swflite" preload="true" generate="true" />
<assets path="Assets" rename="assets" exclude="openfl.svg|*.swf" />
<icon path="Assets/openfl.svg" />
Help sincerely appreciated!
Solved it by switching type="swflite" to type="swf" from project.xml.
Here is part of my project.xml that lets me use .swf library:
<haxelib name="swf" />
<library path="Assets/library.swf" type="swf" preload="true" generate="true" />
<assets path="Assets" rename="assets" exclude="openfl.svg|*.swf" embed="true" />
Now it works just fine, no memory leak.
Related
Lets say that a task needs to be done and there are no data model changes needed(i.e items.xml does not need to be touched).
For example a new Interceptor is needed for an existing Item Type. In this case I just need a new spring bean and a new Java class.
After I do the changes, If I run an "ant build" it takes approximately 1:30(one minute and a half), sometimes even more than that.
From what I noticed Hybris tries to check every extension that is included in localExtension.xml with their required extensions as well, and that is taking a lot of time.
How can I perform a faster build ? It should not take that much time since the only thing that is needed in my Interceptor case is to compile the new Interceptor class, and that's it.
I understand that when data model is changed the models.jar needs to be deleted, the new sources need to be generated and compiled in a new models.jar and that requires time. But in the more simple scenario it should work a lot faster.
PS: I know about JRebel but this question addresses the cases in which the developer does not have JRebel.
In platform/build.xml add below ant target:
<target name="compileExtensions" description="Compiles only the provided extensions">
<compile_only_specified_extensions/>
</target>
In platform/resources/ant/compiling.xml add the macro definition:
<macrodef name="compile_only_specified_extensions">
<sequential>
<foreachextprovidedincli>
<do>
<if>
<not>
<isset property="ext.#{extname}.warextension" />
</not>
<then>
<extension_compile extname="#{extname}" />
</then>
<else>
<external_extension_build extname="#{extname}"/>
</else>
</if>
</do>
</foreachextprovidedincli>
</sequential>
</macrodef>
Define foreachextprovidedincli in platform/resources/ant/util.xml
<macrodef name="foreachextprovidedincli">
<element name="do" optional="false" />
<attribute name="param" default="extname" />
<sequential>
<for list="${extensions.to.compile}" param="#{param}" delimiter=";">
<sequential>
<do />
</sequential>
</for>
</sequential>
</macrodef>
Now what I simply have to do to compile my classes is run the following command:
ant compileExtensions -Dextensions.to.compile="extensionName1;extensionName2;extensionName3"
With above command the build was reduced to 4 seconds.
I've been spending a lot of time trying to track down memory leaks in our Xamarin.Forms app on Android. After a lot of blind alleys and false dawns, I think I may have come across something which is causing the problem.
Using Xamarin Profiler, I can see that as soon as I create a Style and apply it to a control (or in fact just an implicit style), we get Multiple WeakReferences remaining 'Live' - i.e. not garbage collected.
Note that I assume that the objects to which they refer have been GC'd (because the reference to the object is weak), but the WeakReferences themselves are remaining.
Now of course WeakReferences are small I know - but when you have hundreds created on every iteration of a page push/pop, then the memory adds up and we have a significant leak.
Here are the details.
Using Xamarin.Forms 2.3.4.270 (we haven't upgraded because we want to keep with known issues!)
Running on Android - physical device.
App.xaml:
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:ProfiledFormsApp2;assembly=ProfiledFormsApp2"
x:Class="ProfiledFormsApp2.App">
<Application.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="FontSize" Value="Large" />
<Setter Property="TextColor" Value="Blue" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
Page XAML:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage Title="Plain Page" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ProfiledFormsApp2.PlainPage">
<ContentPage.Content>
<StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Core Navigation"/>
<Label Text="Number of items:" />
<Label Text="{Binding ItemsCount}" />
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
When I navigate to the above page and back 3 times, we have the following WeakReference (and related) classes created - the screenshot below is from a Profiler snapshot.
Note we have 55 WeakReferences. Drilling into these shows:
What is interesting is that these WeakReferences seem to be created as part of Behavior and Trigger attaching. Looking at the call tree for the top one gives:
So it appears that the WeakReference was created as part of setting a BindableObject's value and the subsequent setting of the Style.
And it also appears that the WeakReference is still in memory and being referenced by something - the Behavior collection?
Using Profiler, I'm can see that we don't have Labels remaining un GC'd. It seems to be something in the Theme/Behavior/Trigger processing.
I haven't looked at the Xamarin.Forms code on GitHub yet - that might have to be my next action.
Has anyone observed this or got a solution?
I am not sure about the implicit styles to the controls but for the explicit styles you can remove them while page is out of scope OR disappearing.
Example, we applied an explicit style to button
<Button x:Name="btnSave" Style="{StaticResource SaveButtonStyle}" Content="Save"/>
protected override void OnDisappearing()
{
btnSave.Style = null;
base.OnDisappearing();
}
Same can be done with Triggers and Behaviors as well (You can clear them).
I think for the implicit styles, there is something within the code of framework only. We can not identify how default style of control is attached with control as default.
I have been using pretty faces for urls without issue until i started using mapped URLs feature (Section 3.6). http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html#config.actions
I'm getting the output and the actions i want to happen working fine. The problem though is i can't get to to any of my assets under assets folder. i'm getting a 404. The weird thing is that for every other config there hasn't been a problem. And isn't a problem when I run them together. The app is using a template so the links to css's, js's, etc.. are exactly the same. When I go to a plain ol' (e.g. /home) mapping they work fine, go to the other page with the action, they don't work. The template rendering does though. In fact the parameter injection and the action work as well.
PRETTY CONFIG:
<url-mapping id="home"> <!-- assets work -->
<pattern value="/home" />
<view-id value="/home.jsf" />
</url-mapping>
<url-mapping id="validate-token"> <!-- assets don't work -->
<pattern value="/validate-token/type/#{id:validateByTokenController.tokenType}/token/#{validateByTokenController.token}" />
<view-id value="/validate-token.jsf" />
<action>#{validateByTokenController.init}</action>
</url-mapping>
BEAN:
#RequestScoped
#Named
public class ValidateByTokenController {
private String tokenType;
private String token;
public void init() {
token = "J" + token;
tokenType = "J" + tokenType;
}
XHTML SAMPLE CSS LINKS: (same links for "home" config, but not for "validate-token")
<link rel="stylesheet"
href="assets/plugins/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/css/style.css" />
Thanks in advance.
The problem is that you are using relative URLs for your CSS files.
With an URL like /validate-token/type/foo/token/bar the browser thinks that /validate-token/type/foo/token/ is the current directory. So he tries to load the CSS file from /validate-token/type/foo/token/assets/css/style.css.
Try using absolute URLs for your CSS instead:
<link rel="stylesheet" href="#{request.contextPath}/assets/css/style.css" />
I have this assignement where I have to used export for web in quicktime pro 7. Then copy/paste the read me.html file into the body (exactly as it is), which I did.
However, I keep getting 3 errors when I run my .html through W3C and cannot figure out how to correct it.
I realized there are probably better way to embed object but this is how they want us to do it for this assignment. Can anyone help me correct these 3 errors please.
Many thanks in advance.
<object width="350" height="278">
<param name="src" value="swiss/swiss-poster.jpg" />
<param name="href" value="swiss/swiss.mov" />
<param name="target" value="myself" />
<param name="controller" value="false" />
<param name="autoplay" value="false" />
<param name="scale" value="aspect" />
<embed width="350" height="278" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"
src="swiss/swiss-poster.jpg"
href="swiss/swiss.mov"
target="myself"
controller="false"
autoplay="false"
scale="aspect">
</embed>
</object>
Line 1 : Element object is missing one or more of the following attributes: data, type.
Line 14: Attribute href not allowed on element embed at this point.
scale="aspect">
Line 15: Stray end tag embed.
I just needed to embed a quicktime movie myself, and I looked to the Mozilla Developer Network for the syntax: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object
I believe that the data attribute would take the place of href in your params:
param name="href" value="swiss/swiss.mov" />
would be:
<param name="data" value="swiss/swiss.mov" />
and the type in this case would be "video/quicktime":
<param name="type" value="video/quicktime" />
There is also an <embed> reference at MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed), but it covers only the HTML5 version of the element, which doesn't require a closing </embed> tag.
The reference at sitepoint (http://reference.sitepoint.com/html/embed) addresses the earlier syntax, and also says:
"embed isn’t part of any currently recognized standard (it is included in HTML5 which is not yet finalized), so if you use it, your page can’t possibly validate".
That suggests that with <embed> you should probably focus more on actual behavior in the browser than the W3C's validation tool.
Does the current version of Log4net have a way to create a RollingFileAppender with composite rolling style where the rolled files always preserves the given extension (.log in my case)?
Example of the format I would like:
MyLog.log
MyLog.2011-04-10.1.log
MyLog.2011-04-10.2.log
MyLog.2011-04-10.3.log
I found this post which says that there is a "PreserveLogFileNameExtension" property, but that it's not included in the official binaries. Is this still the case?
If so: Can anyone explain why this property is still not an offical part of Log4Net? I am a bit sceptical to use a custom build, but maybe I should not be?
I am also curious to know why the default functionality does not preserve the file extension. I do not see why it would gain the user that all the log files have different extensions.
Edit: Got it working by doing this:
1: Downloading and building the log4net source code
2: Applying these patches: https://issues.apache.org/jira/browse/LOG4NET-64
3: Setting PreserveLogFileNameExtension to "true" in the config.
Have you tried these parameters?
<file value="log-files\MyLog" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd'.log'" />
<param name="StaticLogFileName" value="false" />
It will preserve the extension, but will give you a date in every filename like this.
MyLog2011-05-16.log
MyLog2011-05-17.log
MyLog2011-05-18.log
MyLog2011-05-19.log
Maybe it is possible to combine this with the size rolling?
The situation is unchanged. There is no newer release of log4net. It is quite unclear to me when (if) there will be a new release...
I think you do not need to worry to much about using a custom build. Test your software, if it works it is good enough.
EDIT: There is a new release that should include LOG4NET-64. Of course you can still stick to your custom build.
I'm using this configuration:
<file value="" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.log'" />
<staticLogFileName value="false" />
To get filenames like:
20111101.log
20111102.log
20111103.log