Memory consumption rampant when using FTP file transfer

I’m loading files in a newly installed Ubuntu 18.04 LTS server using FTP, but every single time I copy a file a new process is created on the server side and the old process not being closed, taking insanely amounts of RAM for transferring a large quantity of small size files. Right now I canceled the transfer because it took 6 GiB of RAM of the 8 GiB of the server.

Closing individual process is a mess, because there is a ton of them, so I restart the server after copying a certain amount of files. Why is happening that?

Maximum space consumption of stack and queue for DFS and BFS

I’m trying to determine the maximum memory consumption of the “pending nodes” data structure (stack/queue) for both travelings: BFS and (preorder) DFS.

Since BFS and DFS while traveling graphs have node discovery control (no loops), we can analyze the problem by thinking in terms of trees instead of graphs, where your starting node is taken as root, as usual.

I’ve started by assuming that the resulting traveling is a complete tree (all leafs have same depth), with height $$h$$, $$n$$ nodes, and thus all nodes having degree $$d$$ (except leafs).

Of course, since the tree is complete, $$n$$ can be calculated from $$h$$ and $$d$$:

$$n = \frac{1 – d^{h + 1}}{1 – d}$$

Under this asumption, the worst case scenario for DFS is when you are in the deepest non-leaf node of the first branch of the tree: since each time you pop a node, you insert all of its children, for each level, you have $$D – 1$$ pending nodes in the stack, except in the last non-leaf, where all of its children are inserted.

If you, instead of being in the first branch, were in another one, you would have some branch with less than $$d – 1$$ pending children in the stack, and thus you have less nodes in the stack.

So the maximum memory consumption of DFS for a complete graph with homogeneus degree is ($$ms$$ stands for maximum space):

$$ms = h * (d – 1) + 1$$

This last + 1 represent the extra child for the last non-leaf node. For instance, for a tree with $$d = 4$$ and $$h = 20$$ nodes, a DFS’s stack would require as maximum:

$$ms_{DFS} = 20 * 3 + 1 = 81\ nodes$$

Taking into account that this graph would have $$n = 1.4660155e^{12}$$ nodes, this is a more than admisible amount. That’s the adventage of logarithmic space complexity ($$h = \lfloor log_d((d-1)n)\rfloor$$).

However, for BFS, which have exponential space complexity, the worst case scenario is when you have all leafs pending to be discovered, while having discovered every other node, so your queue contains all leafs (so have the full last-level pending to be discovered but nothing else):

$$ms_{BFS} = d^h\ nodes$$

which, from our example, equals $$1.0995116e^{12}$$.

My problem now is relaxing the restriction of the graph to be complete, so $$d$$ is not an homogeneus degree anymore, but an average degree instead (which can contain now decimals), and the tree can have any disbalance, even being a list. Consequently, the number of nodes is free, so it’s not attach to d and h as before.

If $$d$$ is an average degree and $$n$$ any amount of nodes, I’ve tried to model somehow an upper bound of space consumption by first modelling a complete tree with an homogeneus $$\lfloor d\rfloor$$ degree, and then adding children to the last leaf until getting $$d$$ (I assume that the resulting number of nodes should equal $$n$$, but I’m not sure on that either; I’ve even tried to calculate, given some $$d$$ and $$n$$, a lower and upper bound for the height of the tree).

Since $$d$$ is an average, if some node has more than $$d$$ children is because some other node has less than $$d$$ children, and thus the idea was to find the worst case scenario for DFS and BFS by removing children from one node and moving the cut branch as child of another node or, in general, finding somehow the closest upper bound as possible of memory consumption, but I couldn’t find a way.

The thing is that, if you apply this height increase repeatedly by moving sibling branches to deepest levels, you would probably end up having a lot parent or sibling paths consisting of just lists, which would be removed from the stack/queue very quickly, and thus there must be some tree state where you cannot make the space consumption worst than that. I assume though that the “worst tree” can be different from DFS and BFS though.

Is making this upper bound (or even exact amount) calculation even possible? Or the worst case scenario is just the balanced one?

Can the witch hex “Gift of consumption” be combined with Fortitude(Harmless) spells?

For reference the hex’s descriptions

Gift of Consumption (Su): The witch curses a creature to share any effects that target her vitality. Whenever the witch is exposed to an effect that requires her to attempt a Fortitude save, as an immediate action she can curse a creature within 30 feet to share the effect. The hexed creature must also attempt a Fortitude save at the same DC as the witch’s, and on a failure it is subject to the same effects as the witch. Regardless of the outcome of the saving throw, the creature can’t be targeted by this hex again for 1 day. This hex does not function with effects that require additional types of saves, such as phantasmal killer.

Greater Gift of Consumption (Su) The witch can more effectively redirect effects to her proxy chosen by the gift of consumption hex. When the witch succeeds at her Fortitude save against an effect that she has redirected to a proxy, the hexed creature takes a –4 penalty on its Fortitude save against the redirected effect. If the witch ever fails a Fortitude save or intentionally exposes herself to an effect that requires a Fortitude save, such as by ingesting a poison, she can redirect that effect to affect only the hexed creature, though the hexed creature can still attempt a saving throw to resist the effects. Once she has redirected an effect to another creature in this way, that creature cannot be affected by the gift of consumption hex again for 24 hours. The witch must have the gift of consumption hex to select this hex.

Can the gift of consumption hex be combined with beneficial effects, such as spell “Delay Poison”, which has Fortitude (Harmless) in its save descriptor, and target an ally?

Does the situation change if the witch character has Greater Gift of Consumption?

What may be the reason for unnecessary internet data consumption by Ubuntu 18.04 OS even automatic update is stopped?

In my laptop I installed Ubuntu 18.04 LTS OS as a dual boot OS alongside of Microsoft Windows 10 OS. I stopped the automatic update process. Normally I connecting my laptop with mobile tethering based Wi-Fi hotspot. Recently my laptop consumes more than 1 GB of internet data within few minutes when connecting it without doing any internet access process by manually with frequently. So I tried USB tethering also and I faced same problem. What may be the reasonable causes for my problem and how to resolve it. Guide me to resolve my problem. Thanks in advance.

Device Care (by Samsung) and “Running Services” in developer options show different amount of RAM consumption. What could be the reason?

I have Samsung Phone that is running OneUI and whenever I check RAM consumption in Device Care in settings, it shows something around 700 mb free but when I check the RAM usage in developer options, it shows something like 1.5 GBs. That’s a huge difference. Is Samsung lying to make its app look useful?

(https://i.stack.imgur.com/HB2ef.jpg) (https://imgur.com/OdoiM8X)

Extraordinarily fast battery consumption

I have been using Xiaomi Mi Max (4/128) (now running on MIUI 10.2.1.0) for over two and a half years and as the time passed, my battery started to die pretty quick – I used AccuBattery to check the battery’s health and it was about 40% after 30 charging sessions. On average it could last about 3-4 hours on screen and about 12 hours standby.

My decision was to change the battery and I did it, but the phone still does not work for 8+ hours on screen (as it did before the battery started dying that quick). I took a look at the power usage graph and the thing that suprised me the most was the distribution of power. I know it should be rather exponential than linear, but it was different – first 30% (from 100 to ~70 percent) has been drained in less than an hour, next 45% was used linearly (approximately 10% per hour), and the rest lasted for 20 minutes, going rapidly down to 0%.

Up to now I deleted apps which I was not using, turned on the auto-brightness and the battery saver. I was thinking about doing a factory reset, but at the moment I am unable to save all my photos and data, so I would like to get any ideas what else could I do instead, in order to lenghten the time the battery can last.

Optimization of public methods in java (Memory consumption…)

Does it optimize a programme in java to declare methods private wherever they can be private or it doesn’t change a thing and it’s just a question of encapsulation? I was asking myself if declaring a method public was heavier than a declaring it private in terms of memory consumption.

Fuel consumption and distance

Robin has owned her car for 2 years. In that time, she has driven a total of 68, 000 km. She has had the following maintenance costs over the past 2 years.

• 13 lube, oil and filter services at $$31.95/service – 6 tire rotations at$$24.95/service
• 1 cooling system service at 95.00 – 2 wheel alignments at71.95/service

Robin has a car and has a fuel consumption of 9.8L/100km. Her license plate costs $$74.00 a year and her insurance is$$1475.00 a year. The average cost of gas over the past two years has been \$ 1.28/L.

a) Calculate Robins maintenance costs over the past 2 years

b) Calculate Robin’s fuel costs over the past 2 years

c) Calculate Robin’s operating costs over the past 2 years (maintenance, fuel, license, insurance costs)

d) Calculate the average monthly cost over the past 2 years

e) Calculate her costs per 1 km.

How to fix lags and more RAM consumption in Ubuntu 19.04?

I recently updated to Ubuntu 19.04 from 18.10.

In this version, RAM consumption is more than before. Also, my PC lags every time I open a new app. Sometimes many apps respond with a force quit option.

In 18.10 everything was working nicely with no more than 2 GB RAM consumption.