Open allenzt opened 3 years ago
This is a problem with long term memory usage that is very difficult to deal with. If I allocate lots of memory, then free most of the memory but not a piece of memory which is deep into the heap, the virtual memory use will remain high.
Here is an example: https://github.com/ralight/heap-allocation/blob/master/mem.c
@ralight Thanks very much! Is there any workaround we can do to alleviate the problem ?
I really don't know, but I can't think that there is a realistic solution unfortunately.
does virtual memory used high is better than real memory used high?
Hi everyone,
In my previous test, I found a strange problem, mosquitto did not release the requested memory to the system, is this a bug? any suggestions would be appreciated!
Test steps are as follows:
from multiprocessing import Process import paho.mqtt.client as mqtt import time
def on_connect(client, userdata, flags, rc): print("Connected with result code" + str(rc))
def on_message(client, userdata, msg):
print("topic:" + msg.topic + " " + "mid:" + str(msg.mid) + " " + msg.payload.decode('utf-8'))
def client_loop(max_client): time.sleep(1) client = mqtt.Client(str(max_client), clean_session=False)
client = mqtt.Client(str(max_client), clean_session=True)
def multiclinet_subscribe(max_client_array): processes = [Process(target=client_loop, args=(i, )) for i in max_client_array] for process in processes: process.start() for process in processes: process.join()
if name == "main": client_array = [1, 2, 3, 4, 5, 6] multiclinet_subscribe(client_array)
Environment: Test on mosquitto 1.6.13 and 2.0.11