Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
So I wrote an app in swift/xcode and now I'm at the finish line making sure everything is okay. Using Xcode's memory usage indicator, I noticed that my baseline memory usage increases by 200-300(kB) or about .25 (MB) when I play a level and then return to the main scene. So then I went to instruments and looked at persisting data. I'm thinking some SpriteNode has a runBlock creating a strong reference and found instances of textures with a high reference count, probably related to an explosion animation, and some sound sources weren't being released after the SKAction.playSoundFileNamed(...) was called. Anyways, I tried various fixes, haven't pinpointed whether its sound, explosion animation or something else, but it seems universal, happens after any level, which, along with Instruments, leads me to believe its one of the two (explosion animation or playsoundfile that creates a strong reference cycle). But then part of me feels like I'm chasing a ghost because I really haven't had any performance issues. I'm running in the 20-50 MB range so adding .2 MB per level really doesn't affect anything even if it does it a dozen times (the game is only 9 levels). Although as a perfectionist, it's driving me crazy. So being more practical:
Does apple care about a small memory leak? Does it test for that?
Whether they do or not, consider how this will affect your users. If someone loves your game enough to play it for several hours, will that end up impacting their experience? When is your application unloaded by the OS (i.e. how long will that memory usage persist)? It's obviously better not to leak memory, but "will Apple be unhappy with me" is a less important consideration than "will my users be unhappy with me."
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I'm a 2nd-year student doing my bachelor's degree in Computer Applications. I'm really interested in becoming a Game Programmer and my dream is to work at Rockstar Games😅(it sounds a bit crazy). I'm really worried and I don't know how to program or write code. I'm an absolute beginner. Do you have any tips or advice on how to get there and fulfill my dream? Thanks😀.
I work as a gameplay programmer in Canada so here's a few thing I can tell you.
Best place to start is doing the tutorials on the Unity website. Make a few that interests you and see how you like that. Unity is used in a lot of studios and it's very easy to find a ton of resources online for it. Once your more comfortable with it i'd experiment with unreal also to get an idea for more than 1 engine. While doing all that the idea is for you to build a portfolio of games/projects you can show an employer. Its ez to make ios/android builds to have portable visuals. Game jams are a great place to hone in some skills. Most game jam even lets you join in alone so teams missing people can add you in(programmers are usualy whats missing the most).
For the game industry more or less any programming degree can do but every studio will make you pass a programming test. Knowledge of the engine they use be it Unity/Unreal will be very important. For bigger studios that use their own they look for good c++/c# knowledge an often more experience. At the momment the industry is in dire need of people so its def a good time to join.
If rockstar is your ultimate goal you can certainly try and apply there right away (there's no harm), but its often more difficult to get in via larger studios when you don't know anyone there (also knowing someone on the inside is a major plus anywhere). But even if you don't know anyone, smaller studios have a lot of opennings at the momment and will often give you a a chance. 3 to 5 years experience in is when most opportunities might open up. But again depending on the labour market place may be more desperate.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I made a Swift app which runs very well on iPhone 6 and 6 plus, but when i test it on an iPhone 5 and below, there are some lags.
After analyzing, I saw a high CPU/memory consumption.
I want to know if there are some tips or best practices to reduce this usage?
I know it is very important to use different threads and return to idle when they are not used anymore, but I already do this.
The code which consumes the most resources creates a container (like the notification center) with some buttons on it and applies a blur effect below them.
When you say
After analyze, i saw a high CPU/memory consumption
was that using the time profiler instrument?
The Time Profiler will show you exactly what is consuming CPU resources, as well as your usage of the cores on the CPU, thread delays etc.
Time Profiling with Instruments
I've found this document from Apple to have good tips and tricks on improving performance.
Also make sure you are not doing resource intensive non-UI work on the main thread as this will cause lag on slower devices.
Ok i found where the problem was.
I use a library "FXBlur" to create the blur effect.
This library has a function which update the content of the container every second.
I just modified the code to remove this function, and my CPU usage is now oscillating between 0 and 3 % instead of the 37% that was before.
Thank you everybody for your help.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
In nearly every tutorial for beginner SpriteKit game making I've seen, people delete the GameScene.sks with no real explination.
The reason why building simple non-game apps is so beginner friendly is because of the Storyboard.
Ray uses the GameScene here:
http://www.raywenderlich.com/84341/create-breakout-game-sprite-kit-swift
Is there any reason why NOT to use this tool? Writing out EVERYTHING in code is a little more daunting when you have this tool sitting right here that seems to simplify it a bit.. but I'd rather avoid it if it's better to do so.
Thanks in advance.
It's all personal preference really. I think the reason why people delete it though (at least in my opinion) is due to the following reasons:
You have to specify an initial scene size in the file. Whereas if you create the scene programmatically you can set the size to the view size.
The editor is very limiting. Xcode 7 however greatly expands the editor to include much more such as custom classes.
There were some pretty big bugs/crashes in the initial release of Xcode 6.
When learning Sprite Kit it's good to know how to programmatically do things instead of doing it visually. This is because games often have dynamic gameplay so you will certainly have to do things programmatically (especially when you consider the limitations of the Xcode 6 editor).
Some people (including myself) may use their own custom editor for designing levels etc. Whereas interface builder is standard because it has become very powerful over the years and works perfectly with UIKit.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
quote from http://blog.engineering.kiip.me/post/20988881092/a-year-with-mongodb
Poor Memory Management - MongoDB manages memory by memory mapping your
entire data set, leaving page cache management and faulting up to the
kernel. A more intelligent scheme would be able to do things like
fault in your indexes before use as well as handle faulting in of
cold/hot data more effectively. The result is that memory usage can’t
be effectively reasoned about, and performance is non-optimal.
I don't understand his point. Can someone elaborate on this?
As #cHao said it is a bit of a rant and the author doesn't really understand just how massively complex and intricate the OS' own memory management programs are.
This is why MongoDB does not have its own memory management, because to do so could cause a headache of problems and other nonsense. At the end of the day the OS has a really good memory management process (even Windows does) so why not use that instead of creating one that would require years, maybe even decades to get to the same level?
A more intelligent scheme would be able to do things like fault in your indexes before use
Not sure if MongoDB can read your mind...
I mean what if you have actually designed your system right and don't need ALL (or even those you do in their entirety) your indexes in RAM at the same time?
Doing such pre-emptive paging (not faulting) in of data sounds counter-intuitive to a good setup.
If you require data to be in RAM at certain times you can use touch() http://docs.mongodb.org/manual/reference/command/touch/ or you can run a scirpt of your common queries that you need in RAM.
The result is that memory usage can’t be effectively reasoned about, and performance is non-optimal.
Hmm, that person obviously never actually bothered to use the OS' own inbuilt tools to measure page faulting and memory accession of the mongod process in their testing.
That being said there is actually a tool in the latter version of MongoDB to help cauge memory usage: http://docs.mongodb.org/manual/reference/command/serverStatus/#server-status-workingset
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
Does the state pattern in an iPhone application -- In my case, a relatively light-weight utility application -- use too much memory?
The state pattern, as I understand it, uses several classes; these classes represent different states. All of the different state objects are instantiated and stored in different pointer variables until the state is needed, at which point it is set to a curState object.
I figure that I could lazy load each state object to save some memory and loading time; I could then release the objects if my app receives a memory warning.
But what I wanted to know is does this pattern utilize too much memory for general usage in an iPhone OS application? Should iPhone developers stay away from this pattern? Is there a different pattern that is better suited to the iPhone OS?
Not worth worrying about. Unless your states are immensely complicated, or you have thousands and thousands of them, then any art or media files that are in your application will absolutely swamp them in size.
I mean in general - don't sweat the memory usage of your model objects. Objective-C objects are pretty lightweight, in terms of memory usage. If you've got a fairly typical model class, with say a half-dozen fields, each of which is a pointer to some other object, the total memory usage for each instance of that class is something like 32 bytes or so. If you put 1,000 of them into an array or some other data structure, that'd use about as much memory as a 128x128 bitmap.
You're much more likely to run into memory issues due to hanging on to graphics or sounds that you don't need to, than you ever will from the "working" parts of your application.